Documentation
¶
Overview ¶
Package repeated contains shared layouts for repeated field implementations, for sharing between the tdp packages and the gencode packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bools ¶
Bools is a repeated field containing bools.
func (Bools) Copy ¶
Copy copies these bools to a slice, appending to out.
To get a fresh slice, pass nil to this function.
func (*Bools) ProtoReflect ¶
func (b *Bools) ProtoReflect() protoreflect.List
ProtoReflect returns a reflection value for this list.
type Bytes ¶
Bytes is a repeated field containing bytes.
func (Bytes) Copy ¶
Copy copies these bytes to a slice, appending to out.
If copy is true, this will make defensive copies of the returned strings.
To get a fresh slice, pass nil to this function.
func (*Bytes) ProtoReflect ¶
func (b *Bytes) ProtoReflect() protoreflect.List
ProtoReflect returns a reflection value for this list.
type Messages ¶
type Messages[M any] struct { // Slice[byte] if stride is nonzero, Slice[*Message] otherwise. Raw slice.Untyped // The array stride for when raw is an inlined message list. Stride uint32 }
Messages is a repeated message field.
Repeated messages use two different layouts, and the stride is used to differentiate them. The messages can either be packed into an arena slice, or the arena slice can contain *message pointers. These are called inlined and outlined modes; the stride is zero in the latter case. We switch to the outlined mode to avoid needing to copy parsed messages on slice resize.
M *must* be some type which wraps a dynamic.Message.
func (Messages[M]) Copy ¶
func (m Messages[M]) Copy(out []*M) []*M
Copy copies these scalars to a slice, appending to out.
To get a fresh slice, pass nil to this function.
func (Messages[M]) Get ¶
Get extracts a value at the given index.
Panics if the index is out-of-bounds.
func (*Messages[M]) ProtoReflect ¶
func (m *Messages[M]) ProtoReflect() protoreflect.List
ProtoReflect returns a reflection value for this list.
type Scalars ¶
type Scalars[ZC, E tdp.Number] struct { Raw slice.Untyped // contains filtered or unexported fields }
Scalars is a repeated field containing some varint-encoded type.
A Scalars can be either in zero-copy mode, in which case Raw is a slice of ZC, or in on-arena mode, in which case it is a slice of E. These can be distinct in the case of varint fields, which are only zero-copy when they are filled with byte-sized values.
func (Scalars[ZC, E]) Copy ¶
func (s Scalars[ZC, E]) Copy(out []E) []E
Copy copies these scalars to a slice, appending to out.
To get a fresh slice, pass nil to this function.
func (Scalars[ZC, E]) Get ¶
Get extracts a value at the given index.
Panics if the index is out-of-bounds.
func (*Scalars[ZC, E]) ProtoReflect ¶
func (s *Scalars[ZC, E]) ProtoReflect() protoreflect.List
ProtoReflect returns a reflection value for this list.
type Strings ¶
type Strings struct {
Src *byte
Raw slice.Slice[zc.Range]
// contains filtered or unexported fields
}
Strings is a repeated field containing strings.
The elements are zero-copy ranges relative to a source pointer.
func (Strings) Copy ¶
Copy copies these strings to a slice, appending to out.
If copy is true, this will make defensive copies of the returned strings.
To get a fresh slice, pass nil to this function.
func (*Strings) ProtoReflect ¶
func (s *Strings) ProtoReflect() protoreflect.List
ProtoReflect returns a reflection value for this list.
type Zigzags ¶
type Zigzags[ZC, E tdp.Number] struct { Raw slice.Untyped // contains filtered or unexported fields }
Zigzags is like Scalars, btu the elements are zigzag-encoded.
func (Zigzags[ZC, E]) Copy ¶
func (z Zigzags[ZC, E]) Copy(out []E) []E
Copy copies these scalars to a slice, appending to out.
To get a fresh slice, pass nil to this function.
func (Zigzags[ZC, E]) Get ¶
Get extracts a value at the given index.
Panics if the index is out-of-bounds.
func (*Zigzags[ZC, E]) ProtoReflect ¶
func (s *Zigzags[ZC, E]) ProtoReflect() protoreflect.List
ProtoReflect returns a reflection value for this list.