Help us shape the future of Go! Take the 2026 Go Developer Survey

packagetable

package
v1.87.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package packagetable owns frozen package storage. Its private backing fields make writes through the lisp kernel's read accessors a compile-time error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lists added in v1.81.0

type Lists struct {
	// contains filtered or unexported fields
}

Lists is a read-only string-keyed table of name lists. Its zero value is an empty table. A list is never handed out: callers read it by index. The table is one slice of pairs sorted by key, then value, so a table of any size is one allocation.

func AdoptPairs added in v1.81.0

func AdoptPairs(pairs []Pair) Lists

AdoptPairs takes ownership of pairs, sorts them by key, then value, and returns them as a table: each key's list is its pairs' values in order. The caller must not use pairs after the call.

func NewLists added in v1.81.0

func NewLists(values map[string][]string) Lists

NewLists takes a private snapshot of the table and of every list; the caller keeps ownership of values. Each list must be sorted.

func (Lists) All added in v1.81.0

func (l Lists) All() iter.Seq[Pair]

All visits every pair in order: by key, then value.

func (Lists) At added in v1.81.0

func (l Lists) At(key string, i int) string

At returns element i of the list stored under key.

func (Lists) Copy added in v1.81.0

func (l Lists) Copy() map[string][]string

Copy returns a mutable copy of the table and of every list, never the backing storage.

func (Lists) Keys added in v1.81.0

func (l Lists) Keys() []string

Keys returns a fresh, sorted list of keys.

func (Lists) Len added in v1.81.0

func (l Lists) Len() int

Len returns the number of keys.

func (Lists) List added in v1.81.0

func (l Lists) List(key string) iter.Seq[string]

List visits the list stored under key in order.

func (Lists) ListLen added in v1.81.0

func (l Lists) ListLen(key string) int

ListLen returns the length of the list stored under key, 0 when none is.

func (Lists) Span added in v1.81.0

func (l Lists) Span(key string) (int, int)

Span returns the bounds lo and hi of the list stored under key: its elements are ValueAt(lo) to ValueAt(hi-1). lo == hi when no list is stored.

func (Lists) ValueAt added in v1.81.0

func (l Lists) ValueAt(i int) string

ValueAt returns the value of pair i, for i in a range Span returned.

type Map

type Map[V Scalar] struct {
	// contains filtered or unexported fields
}

Map is a read-only string-keyed table. Its zero value is an empty table.

func AdoptMap

func AdoptMap[V Scalar](values map[string]V) Map[V]

AdoptMap takes ownership of values without copying. The caller must hold no other reference to values; it is for a map the caller has just built.

func NewMap

func NewMap[V Scalar](values map[string]V) Map[V]

NewMap takes a private snapshot; the caller keeps ownership of values.

func (Map[V]) All

func (m Map[V]) All() iter.Seq2[string, V]

All visits entries in key order.

func (Map[V]) Copy

func (m Map[V]) Copy() map[string]V

Copy returns a mutable copy, never the backing map.

func (Map[V]) Keys

func (m Map[V]) Keys() []string

Keys returns a fresh, sorted list of keys.

func (Map[V]) Len

func (m Map[V]) Len() int

Len returns the number of entries.

func (Map[V]) Lookup

func (m Map[V]) Lookup(key string) (V, bool)

Lookup returns an entry and whether it exists.

func (Map[V]) Unordered added in v1.75.0

func (m Map[V]) Unordered() iter.Seq2[string, V]

Unordered visits entries in no fixed order, without allocating. A caller must compute a result that does not depend on the order, such as a minimum.

type Pair added in v1.81.0

type Pair struct {
	Key, Value string
}

Pair is one entry of a Lists table: Value is in the list of Key.

type Scalar

type Scalar interface {
	~string | ~int
}

Scalar excludes pointers and other mutable values: a copy of a table entry must not provide a way to modify the table's storage.

type Strings

type Strings struct {
	// contains filtered or unexported fields
}

Strings is a read-only list of export names in declaration order. Its zero value is an empty list.

func AdoptStrings added in v1.73.0

func AdoptStrings(values []string) Strings

AdoptStrings takes ownership of values without copying. The caller must hold no other reference to the backing slice, as with AdoptMap.

func NewStrings

func NewStrings(values []string) Strings

NewStrings takes a private snapshot; the caller keeps ownership of values.

func (Strings) All

func (s Strings) All() iter.Seq[string]

All visits names in declaration order, including duplicates.

func (Strings) Copy

func (s Strings) Copy() []string

Copy returns a mutable copy, never the backing slice.

func (Strings) Len

func (s Strings) Len() int

Len returns the number of names.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL