Documentation
¶
Index ¶
- type A
- func (c *A) CachedCanotoSize() uint64
- func (c *A) CalculateCanotoCache()
- func (*A) CanotoSpec(...reflect.Type) *canoto.Spec
- func (*A) MakeCanoto() *A
- func (c *A) MarshalCanoto() []byte
- func (c *A) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *A) UnmarshalCanoto(bytes []byte) error
- func (c *A) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *A) ValidCanoto() bool
- type A__B
- func (c *A__B) CachedCanotoSize() uint64
- func (c *A__B) CalculateCanotoCache()
- func (*A__B) CanotoSpec(...reflect.Type) *canoto.Spec
- func (*A__B) MakeCanoto() *A__B
- func (c *A__B) MarshalCanoto() []byte
- func (c *A__B) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *A__B) UnmarshalCanoto(bytes []byte) error
- func (c *A__B) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *A__B) ValidCanoto() bool
- type Embedded
- func (c *Embedded) CachedCanotoSize() uint64
- func (c *Embedded) CalculateCanotoCache()
- func (*Embedded) CanotoSpec(types ...reflect.Type) *canoto.Spec
- func (*Embedded) MakeCanoto() *Embedded
- func (c *Embedded) MarshalCanoto() []byte
- func (c *Embedded) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *Embedded) UnmarshalCanoto(bytes []byte) error
- func (c *Embedded) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *Embedded) ValidCanoto() bool
- type GenericField
- func (c *GenericField[T1, T2, T3]) CachedCanotoSize() uint64
- func (c *GenericField[T1, T2, T3]) CalculateCanotoCache()
- func (*GenericField[T1, T2, T3]) CanotoSpec(types ...reflect.Type) *canoto.Spec
- func (*GenericField[T1, T2, T3]) MakeCanoto() *GenericField[T1, T2, T3]
- func (c *GenericField[T1, T2, T3]) MarshalCanoto() []byte
- func (c *GenericField[T1, T2, T3]) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *GenericField[T1, T2, T3]) UnmarshalCanoto(bytes []byte) error
- func (c *GenericField[T1, T2, T3]) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *GenericField[T1, T2, T3]) ValidCanoto() bool
- type LargestFieldNumber
- func (c *LargestFieldNumber[T1]) CachedCanotoSize() uint64
- func (c *LargestFieldNumber[T1]) CalculateCanotoCache()
- func (*LargestFieldNumber[T1]) CanotoSpec(...reflect.Type) *canoto.Spec
- func (*LargestFieldNumber[T1]) MakeCanoto() *LargestFieldNumber[T1]
- func (c *LargestFieldNumber[T1]) MarshalCanoto() []byte
- func (c *LargestFieldNumber[T1]) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *LargestFieldNumber[T1]) UnmarshalCanoto(bytes []byte) error
- func (c *LargestFieldNumber[T1]) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *LargestFieldNumber[T1]) ValidCanoto() bool
- type NestedGenericField
- func (c *NestedGenericField[T1, T2, T3]) CachedCanotoSize() uint64
- func (c *NestedGenericField[T1, T2, T3]) CalculateCanotoCache()
- func (*NestedGenericField[T1, T2, T3]) CanotoSpec(types ...reflect.Type) *canoto.Spec
- func (*NestedGenericField[T1, T2, T3]) MakeCanoto() *NestedGenericField[T1, T2, T3]
- func (c *NestedGenericField[T1, T2, T3]) MarshalCanoto() []byte
- func (c *NestedGenericField[T1, T2, T3]) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *NestedGenericField[T1, T2, T3]) UnmarshalCanoto(bytes []byte) error
- func (c *NestedGenericField[T1, T2, T3]) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *NestedGenericField[T1, T2, T3]) ValidCanoto() bool
- type Node
- func (c *Node) CachedCanotoSize() uint64
- func (c *Node) CachedWhichOneOfOneOf() uint32
- func (c *Node) CalculateCanotoCache()
- func (*Node) CanotoSpec(types ...reflect.Type) *canoto.Spec
- func (*Node) MakeCanoto() *Node
- func (c *Node) MarshalCanoto() []byte
- func (c *Node) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *Node) UnmarshalCanoto(bytes []byte) error
- func (c *Node) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *Node) ValidCanoto() bool
- type OneOf
- func (c *OneOf) CachedCanotoSize() uint64
- func (c *OneOf) CachedWhichOneOfA() uint32
- func (c *OneOf) CachedWhichOneOfB() uint32
- func (c *OneOf) CalculateCanotoCache()
- func (*OneOf) CanotoSpec(...reflect.Type) *canoto.Spec
- func (*OneOf) MakeCanoto() *OneOf
- func (c *OneOf) MarshalCanoto() []byte
- func (c *OneOf) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *OneOf) UnmarshalCanoto(bytes []byte) error
- func (c *OneOf) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *OneOf) ValidCanoto() bool
- type OneOfNoCopy
- func (c *OneOfNoCopy) CachedCanotoSize() uint64
- func (c *OneOfNoCopy) CachedWhichOneOfA() uint32
- func (c *OneOfNoCopy) CachedWhichOneOfB() uint32
- func (c *OneOfNoCopy) CalculateCanotoCache()
- func (*OneOfNoCopy) CanotoSpec(...reflect.Type) *canoto.Spec
- func (*OneOfNoCopy) MakeCanoto() *OneOfNoCopy
- func (c *OneOfNoCopy) MarshalCanoto() []byte
- func (c *OneOfNoCopy) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *OneOfNoCopy) UnmarshalCanoto(bytes []byte) error
- func (c *OneOfNoCopy) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *OneOfNoCopy) ValidCanoto() bool
- type RecursiveA
- func (c *RecursiveA) CachedCanotoSize() uint64
- func (c *RecursiveA) CalculateCanotoCache()
- func (*RecursiveA) CanotoSpec(types ...reflect.Type) *canoto.Spec
- func (*RecursiveA) MakeCanoto() *RecursiveA
- func (c *RecursiveA) MarshalCanoto() []byte
- func (c *RecursiveA) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *RecursiveA) UnmarshalCanoto(bytes []byte) error
- func (c *RecursiveA) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *RecursiveA) ValidCanoto() bool
- type RecursiveB
- func (c *RecursiveB) CachedCanotoSize() uint64
- func (c *RecursiveB) CalculateCanotoCache()
- func (*RecursiveB) CanotoSpec(types ...reflect.Type) *canoto.Spec
- func (*RecursiveB) MakeCanoto() *RecursiveB
- func (c *RecursiveB) MarshalCanoto() []byte
- func (c *RecursiveB) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *RecursiveB) UnmarshalCanoto(bytes []byte) error
- func (c *RecursiveB) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *RecursiveB) ValidCanoto() bool
- type Scalars
- func (c *Scalars) CachedCanotoSize() uint64
- func (c *Scalars) CalculateCanotoCache()
- func (*Scalars) CanotoSpec(types ...reflect.Type) *canoto.Spec
- func (*Scalars) MakeCanoto() *Scalars
- func (c *Scalars) MarshalCanoto() []byte
- func (c *Scalars) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *Scalars) UnmarshalCanoto(bytes []byte) error
- func (c *Scalars) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *Scalars) ValidCanoto() bool
- type SpecUnusedZero
- func (c *SpecUnusedZero) CachedCanotoSize() uint64
- func (c *SpecUnusedZero) CalculateCanotoCache()
- func (*SpecUnusedZero) CanotoSpec(...reflect.Type) *canoto.Spec
- func (*SpecUnusedZero) MakeCanoto() *SpecUnusedZero
- func (c *SpecUnusedZero) MarshalCanoto() []byte
- func (c *SpecUnusedZero) MarshalCanotoInto(w canoto.Writer) canoto.Writer
- func (c *SpecUnusedZero) UnmarshalCanoto(bytes []byte) error
- func (c *SpecUnusedZero) UnmarshalCanotoFrom(r canoto.Reader) error
- func (c *SpecUnusedZero) ValidCanoto() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type A ¶ added in v0.8.1
type A struct {
B__C int32 `canoto:"int,1"`
// contains filtered or unexported fields
}
Check for name collisions. Because we use "__" as a separator, the unescaped name would conflict as canoto__A__B__C__tag.
func (*A) CachedCanotoSize ¶ added in v0.8.1
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*A) CalculateCanotoCache ¶ added in v0.8.1
func (c *A) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*A) CanotoSpec ¶ added in v0.13.1
CanotoSpec returns the specification of this canoto message.
func (*A) MakeCanoto ¶ added in v0.8.1
MakeCanoto creates a new empty value.
func (*A) MarshalCanoto ¶ added in v0.8.1
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*A) MarshalCanotoInto ¶ added in v0.8.1
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*A) UnmarshalCanoto ¶ added in v0.8.1
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*A) UnmarshalCanotoFrom ¶ added in v0.8.1
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*A) ValidCanoto ¶ added in v0.8.1
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type A__B ¶ added in v0.8.1
type A__B struct {
C int32 `canoto:"int,1"`
// contains filtered or unexported fields
}
func (*A__B) CachedCanotoSize ¶ added in v0.8.1
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*A__B) CalculateCanotoCache ¶ added in v0.8.1
func (c *A__B) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*A__B) CanotoSpec ¶ added in v0.13.1
CanotoSpec returns the specification of this canoto message.
func (*A__B) MakeCanoto ¶ added in v0.8.1
MakeCanoto creates a new empty value.
func (*A__B) MarshalCanoto ¶ added in v0.8.1
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*A__B) MarshalCanotoInto ¶ added in v0.8.1
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*A__B) UnmarshalCanoto ¶ added in v0.8.1
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*A__B) UnmarshalCanotoFrom ¶ added in v0.8.1
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*A__B) ValidCanoto ¶ added in v0.8.1
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type Embedded ¶ added in v0.8.1
type Embedded struct {
OneOf `canoto:"value,1"`
*LargestFieldNumber[uint32] `canoto:"pointer,2"`
*GenericField[OneOf, *OneOf, *OneOf] `canoto:"field,3"`
*big.Int `canoto:"pointer,4"`
// contains filtered or unexported fields
}
func (*Embedded) CachedCanotoSize ¶ added in v0.8.1
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*Embedded) CalculateCanotoCache ¶ added in v0.8.1
func (c *Embedded) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*Embedded) CanotoSpec ¶ added in v0.13.1
CanotoSpec returns the specification of this canoto message.
func (*Embedded) MakeCanoto ¶ added in v0.8.1
MakeCanoto creates a new empty value.
func (*Embedded) MarshalCanoto ¶ added in v0.8.1
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*Embedded) MarshalCanotoInto ¶ added in v0.8.1
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*Embedded) UnmarshalCanoto ¶ added in v0.8.1
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*Embedded) UnmarshalCanotoFrom ¶ added in v0.8.1
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*Embedded) ValidCanoto ¶ added in v0.8.1
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type GenericField ¶ added in v0.4.0
type GenericField[V any, _ canoto.FieldPointer[V], T canoto.FieldMaker[T]] struct { Value V `canoto:"value,1"` RepeatedValue []V `canoto:"repeated value,2"` FixedRepeatedValue [3]V `canoto:"fixed repeated value,3"` Pointer *V `canoto:"pointer,4"` RepeatedPointer []*V `canoto:"repeated pointer,5"` FixedRepeatedPointer [3]*V `canoto:"fixed repeated pointer,6"` Field T `canoto:"field,7"` RepeatedField []T `canoto:"repeated field,8"` FixedRepeatedField [3]T `canoto:"fixed repeated field,9"` // contains filtered or unexported fields }
func (*GenericField[T1, T2, T3]) CachedCanotoSize ¶ added in v0.4.0
func (c *GenericField[T1, T2, T3]) CachedCanotoSize() uint64
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*GenericField[T1, T2, T3]) CalculateCanotoCache ¶ added in v0.4.0
func (c *GenericField[T1, T2, T3]) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*GenericField[T1, T2, T3]) CanotoSpec ¶ added in v0.13.1
func (*GenericField[T1, T2, T3]) CanotoSpec(types ...reflect.Type) *canoto.Spec
CanotoSpec returns the specification of this canoto message.
func (*GenericField[T1, T2, T3]) MakeCanoto ¶ added in v0.7.0
func (*GenericField[T1, T2, T3]) MakeCanoto() *GenericField[T1, T2, T3]
MakeCanoto creates a new empty value.
func (*GenericField[T1, T2, T3]) MarshalCanoto ¶ added in v0.4.0
func (c *GenericField[T1, T2, T3]) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*GenericField[T1, T2, T3]) MarshalCanotoInto ¶ added in v0.4.0
func (c *GenericField[T1, T2, T3]) MarshalCanotoInto(w canoto.Writer) canoto.Writer
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*GenericField[T1, T2, T3]) UnmarshalCanoto ¶ added in v0.4.0
func (c *GenericField[T1, T2, T3]) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*GenericField[T1, T2, T3]) UnmarshalCanotoFrom ¶ added in v0.4.0
func (c *GenericField[T1, T2, T3]) UnmarshalCanotoFrom(r canoto.Reader) error
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*GenericField[T1, T2, T3]) ValidCanoto ¶ added in v0.4.0
func (c *GenericField[T1, T2, T3]) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type LargestFieldNumber ¶
type LargestFieldNumber[T canoto.Uint] struct { Uint T `canoto:"uint,536870911"` // contains filtered or unexported fields }
func (*LargestFieldNumber[T1]) CachedCanotoSize ¶
func (c *LargestFieldNumber[T1]) CachedCanotoSize() uint64
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*LargestFieldNumber[T1]) CalculateCanotoCache ¶
func (c *LargestFieldNumber[T1]) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*LargestFieldNumber[T1]) CanotoSpec ¶ added in v0.13.1
func (*LargestFieldNumber[T1]) CanotoSpec(...reflect.Type) *canoto.Spec
CanotoSpec returns the specification of this canoto message.
func (*LargestFieldNumber[T1]) MakeCanoto ¶ added in v0.7.0
func (*LargestFieldNumber[T1]) MakeCanoto() *LargestFieldNumber[T1]
MakeCanoto creates a new empty value.
func (*LargestFieldNumber[T1]) MarshalCanoto ¶
func (c *LargestFieldNumber[T1]) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*LargestFieldNumber[T1]) MarshalCanotoInto ¶
func (c *LargestFieldNumber[T1]) MarshalCanotoInto(w canoto.Writer) canoto.Writer
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*LargestFieldNumber[T1]) UnmarshalCanoto ¶
func (c *LargestFieldNumber[T1]) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*LargestFieldNumber[T1]) UnmarshalCanotoFrom ¶
func (c *LargestFieldNumber[T1]) UnmarshalCanotoFrom(r canoto.Reader) error
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*LargestFieldNumber[T1]) ValidCanoto ¶
func (c *LargestFieldNumber[T1]) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type NestedGenericField ¶ added in v0.5.0
type NestedGenericField[V any, P canoto.FieldPointer[V], T canoto.FieldMaker[T]] struct { Value GenericField[V, P, T] `canoto:"value,1"` RepeatedValue []GenericField[V, P, T] `canoto:"repeated value,2"` FixedRepeatedValue [3]GenericField[V, P, T] `canoto:"fixed repeated value,3"` Pointer *GenericField[V, P, T] `canoto:"pointer,4"` RepeatedPointer []*GenericField[V, P, T] `canoto:"repeated pointer,5"` FixedRepeatedPointer [3]*GenericField[V, P, T] `canoto:"fixed repeated pointer,6"` Field *GenericField[V, P, T] `canoto:"field,7"` RepeatedField []*GenericField[V, P, T] `canoto:"repeated field,8"` FixedRepeatedField [3]*GenericField[V, P, T] `canoto:"fixed repeated field,9"` // contains filtered or unexported fields }
func (*NestedGenericField[T1, T2, T3]) CachedCanotoSize ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2, T3]) CachedCanotoSize() uint64
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*NestedGenericField[T1, T2, T3]) CalculateCanotoCache ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2, T3]) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*NestedGenericField[T1, T2, T3]) CanotoSpec ¶ added in v0.13.1
func (*NestedGenericField[T1, T2, T3]) CanotoSpec(types ...reflect.Type) *canoto.Spec
CanotoSpec returns the specification of this canoto message.
func (*NestedGenericField[T1, T2, T3]) MakeCanoto ¶ added in v0.7.0
func (*NestedGenericField[T1, T2, T3]) MakeCanoto() *NestedGenericField[T1, T2, T3]
MakeCanoto creates a new empty value.
func (*NestedGenericField[T1, T2, T3]) MarshalCanoto ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2, T3]) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*NestedGenericField[T1, T2, T3]) MarshalCanotoInto ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2, T3]) MarshalCanotoInto(w canoto.Writer) canoto.Writer
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*NestedGenericField[T1, T2, T3]) UnmarshalCanoto ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2, T3]) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*NestedGenericField[T1, T2, T3]) UnmarshalCanotoFrom ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2, T3]) UnmarshalCanotoFrom(r canoto.Reader) error
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*NestedGenericField[T1, T2, T3]) ValidCanoto ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2, T3]) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type Node ¶ added in v0.13.1
type Node struct {
Value int32 `canoto:"int,1"`
Next *Node `canoto:"pointer,2,OneOf"`
// contains filtered or unexported fields
}
func (*Node) CachedCanotoSize ¶ added in v0.13.1
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*Node) CachedWhichOneOfOneOf ¶ added in v0.13.1
CachedWhichOneOfOneOf returns the previously calculated field number used to represent OneOf.
This field is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CalculateCanotoCache.
If the field has not yet been cached, it will return 0.
If the struct has been modified since the field was last cached, the returned field number may be incorrect.
func (*Node) CalculateCanotoCache ¶ added in v0.13.1
func (c *Node) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*Node) CanotoSpec ¶ added in v0.13.1
CanotoSpec returns the specification of this canoto message.
func (*Node) MakeCanoto ¶ added in v0.13.1
MakeCanoto creates a new empty value.
func (*Node) MarshalCanoto ¶ added in v0.13.1
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*Node) MarshalCanotoInto ¶ added in v0.13.1
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*Node) UnmarshalCanoto ¶ added in v0.13.1
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*Node) UnmarshalCanotoFrom ¶ added in v0.13.1
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*Node) ValidCanoto ¶ added in v0.13.1
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type OneOf ¶
type OneOf struct {
A1 int32 `canoto:"int,1,A"`
A2 int64 `canoto:"int,7,A"`
B1 int32 `canoto:"int,3,B"`
B2 int64 `canoto:"int,4,B"`
C int32 `canoto:"int,5"`
D int64 `canoto:"int,6"`
// contains filtered or unexported fields
}
func (*OneOf) CachedCanotoSize ¶
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*OneOf) CachedWhichOneOfA ¶
CachedWhichOneOfA returns the previously calculated field number used to represent A.
This field is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CalculateCanotoCache.
If the field has not yet been cached, it will return 0.
If the struct has been modified since the field was last cached, the returned field number may be incorrect.
func (*OneOf) CachedWhichOneOfB ¶
CachedWhichOneOfB returns the previously calculated field number used to represent B.
This field is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CalculateCanotoCache.
If the field has not yet been cached, it will return 0.
If the struct has been modified since the field was last cached, the returned field number may be incorrect.
func (*OneOf) CalculateCanotoCache ¶
func (c *OneOf) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*OneOf) CanotoSpec ¶ added in v0.13.1
CanotoSpec returns the specification of this canoto message.
func (*OneOf) MakeCanoto ¶ added in v0.7.0
MakeCanoto creates a new empty value.
func (*OneOf) MarshalCanoto ¶
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*OneOf) MarshalCanotoInto ¶
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*OneOf) UnmarshalCanoto ¶
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*OneOf) UnmarshalCanotoFrom ¶
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*OneOf) ValidCanoto ¶
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type OneOfNoCopy ¶ added in v0.17.2
type OneOfNoCopy struct {
A1 int32 `canoto:"int,1,A"`
A2 int64 `canoto:"int,7,A"`
B1 int32 `canoto:"int,3,B"`
B2 int64 `canoto:"int,4,B"`
C int32 `canoto:"int,5"`
D int64 `canoto:"int,6"`
// contains filtered or unexported fields
}
func (*OneOfNoCopy) CachedCanotoSize ¶ added in v0.17.2
func (c *OneOfNoCopy) CachedCanotoSize() uint64
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*OneOfNoCopy) CachedWhichOneOfA ¶ added in v0.17.2
func (c *OneOfNoCopy) CachedWhichOneOfA() uint32
CachedWhichOneOfA returns the previously calculated field number used to represent A.
This field is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CalculateCanotoCache.
If the field has not yet been cached, it will return 0.
If the struct has been modified since the field was last cached, the returned field number may be incorrect.
func (*OneOfNoCopy) CachedWhichOneOfB ¶ added in v0.17.2
func (c *OneOfNoCopy) CachedWhichOneOfB() uint32
CachedWhichOneOfB returns the previously calculated field number used to represent B.
This field is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CalculateCanotoCache.
If the field has not yet been cached, it will return 0.
If the struct has been modified since the field was last cached, the returned field number may be incorrect.
func (*OneOfNoCopy) CalculateCanotoCache ¶ added in v0.17.2
func (c *OneOfNoCopy) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
func (*OneOfNoCopy) CanotoSpec ¶ added in v0.17.2
func (*OneOfNoCopy) CanotoSpec(...reflect.Type) *canoto.Spec
CanotoSpec returns the specification of this canoto message.
func (*OneOfNoCopy) MakeCanoto ¶ added in v0.17.2
func (*OneOfNoCopy) MakeCanoto() *OneOfNoCopy
MakeCanoto creates a new empty value.
func (*OneOfNoCopy) MarshalCanoto ¶ added in v0.17.2
func (c *OneOfNoCopy) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*OneOfNoCopy) MarshalCanotoInto ¶ added in v0.17.2
func (c *OneOfNoCopy) MarshalCanotoInto(w canoto.Writer) canoto.Writer
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*OneOfNoCopy) UnmarshalCanoto ¶ added in v0.17.2
func (c *OneOfNoCopy) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*OneOfNoCopy) UnmarshalCanotoFrom ¶ added in v0.17.2
func (c *OneOfNoCopy) UnmarshalCanotoFrom(r canoto.Reader) error
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*OneOfNoCopy) ValidCanoto ¶ added in v0.17.2
func (c *OneOfNoCopy) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type RecursiveA ¶ added in v0.13.1
type RecursiveA struct {
Next *RecursiveB `canoto:"pointer,1"`
// contains filtered or unexported fields
}
func (*RecursiveA) CachedCanotoSize ¶ added in v0.13.1
func (c *RecursiveA) CachedCanotoSize() uint64
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*RecursiveA) CalculateCanotoCache ¶ added in v0.13.1
func (c *RecursiveA) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*RecursiveA) CanotoSpec ¶ added in v0.13.1
func (*RecursiveA) CanotoSpec(types ...reflect.Type) *canoto.Spec
CanotoSpec returns the specification of this canoto message.
func (*RecursiveA) MakeCanoto ¶ added in v0.13.1
func (*RecursiveA) MakeCanoto() *RecursiveA
MakeCanoto creates a new empty value.
func (*RecursiveA) MarshalCanoto ¶ added in v0.13.1
func (c *RecursiveA) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*RecursiveA) MarshalCanotoInto ¶ added in v0.13.1
func (c *RecursiveA) MarshalCanotoInto(w canoto.Writer) canoto.Writer
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*RecursiveA) UnmarshalCanoto ¶ added in v0.13.1
func (c *RecursiveA) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*RecursiveA) UnmarshalCanotoFrom ¶ added in v0.13.1
func (c *RecursiveA) UnmarshalCanotoFrom(r canoto.Reader) error
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*RecursiveA) ValidCanoto ¶ added in v0.13.1
func (c *RecursiveA) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type RecursiveB ¶ added in v0.13.1
type RecursiveB struct {
Next *RecursiveA `canoto:"pointer,1"`
// contains filtered or unexported fields
}
func (*RecursiveB) CachedCanotoSize ¶ added in v0.13.1
func (c *RecursiveB) CachedCanotoSize() uint64
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*RecursiveB) CalculateCanotoCache ¶ added in v0.13.1
func (c *RecursiveB) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*RecursiveB) CanotoSpec ¶ added in v0.13.1
func (*RecursiveB) CanotoSpec(types ...reflect.Type) *canoto.Spec
CanotoSpec returns the specification of this canoto message.
func (*RecursiveB) MakeCanoto ¶ added in v0.13.1
func (*RecursiveB) MakeCanoto() *RecursiveB
MakeCanoto creates a new empty value.
func (*RecursiveB) MarshalCanoto ¶ added in v0.13.1
func (c *RecursiveB) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*RecursiveB) MarshalCanotoInto ¶ added in v0.13.1
func (c *RecursiveB) MarshalCanotoInto(w canoto.Writer) canoto.Writer
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*RecursiveB) UnmarshalCanoto ¶ added in v0.13.1
func (c *RecursiveB) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*RecursiveB) UnmarshalCanotoFrom ¶ added in v0.13.1
func (c *RecursiveB) UnmarshalCanotoFrom(r canoto.Reader) error
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*RecursiveB) ValidCanoto ¶ added in v0.13.1
func (c *RecursiveB) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type Scalars ¶
type Scalars struct {
Int8 int8 `canoto:"int,1"`
Int16 int16 `canoto:"int,2"`
Int32 int32 `canoto:"int,3"`
Int64 int64 `canoto:"int,4"`
Uint8 uint8 `canoto:"uint,5"`
Uint16 uint16 `canoto:"uint,6"`
Uint32 uint32 `canoto:"uint,7"`
Uint64 uint64 `canoto:"uint,8"`
Sfixed32 int32 `canoto:"fint32,9"`
Fixed32 uint32 `canoto:"fint32,10"`
Sfixed64 int64 `canoto:"fint64,11"`
Fixed64 uint64 `canoto:"fint64,12"`
Bool bool `canoto:"bool,13"`
String string `canoto:"string,14"`
Bytes []byte `canoto:"bytes,15"`
LargestFieldNumber LargestFieldNumber[uint32] `canoto:"value,16"`
RepeatedInt8 []int8 `canoto:"repeated int,17"`
RepeatedInt16 []int16 `canoto:"repeated int,18"`
RepeatedInt32 []int32 `canoto:"repeated int,19"`
RepeatedInt64 []int64 `canoto:"repeated int,20"`
RepeatedUint8 []uint8 `canoto:"repeated uint,21"`
RepeatedUint16 []uint16 `canoto:"repeated uint,22"`
RepeatedUint32 []uint32 `canoto:"repeated uint,23"`
RepeatedUint64 []uint64 `canoto:"repeated uint,24"`
RepeatedSfixed32 []int32 `canoto:"repeated fint32,25"`
RepeatedFixed32 []uint32 `canoto:"repeated fint32,26"`
RepeatedSfixed64 []int64 `canoto:"repeated fint64,27"`
RepeatedFixed64 []uint64 `canoto:"repeated fint64,28"`
RepeatedBool []bool `canoto:"repeated bool,29"`
RepeatedString []string `canoto:"repeated string,30"`
RepeatedBytes [][]byte `canoto:"repeated bytes,31"`
RepeatedLargestFieldNumber []LargestFieldNumber[uint32] `canoto:"repeated value,32"`
FixedRepeatedInt8 [3]int8 `canoto:"fixed repeated int,33"`
FixedRepeatedInt16 [3]int16 `canoto:"fixed repeated int,34"`
FixedRepeatedInt32 [3]int32 `canoto:"fixed repeated int,35"`
FixedRepeatedInt64 [3]int64 `canoto:"fixed repeated int,36"`
FixedRepeatedUint8 [3]uint8 `canoto:"fixed repeated uint,37"`
FixedRepeatedUint16 [3]uint16 `canoto:"fixed repeated uint,38"`
FixedRepeatedUint32 [3]uint32 `canoto:"fixed repeated uint,39"`
FixedRepeatedUint64 [3]uint64 `canoto:"fixed repeated uint,40"`
FixedRepeatedSfixed32 [3]int32 `canoto:"fixed repeated fint32,41"`
FixedRepeatedFixed32 [3]uint32 `canoto:"fixed repeated fint32,42"`
FixedRepeatedSfixed64 [3]int64 `canoto:"fixed repeated fint64,43"`
FixedRepeatedFixed64 [3]uint64 `canoto:"fixed repeated fint64,44"`
FixedRepeatedBool [3]bool `canoto:"fixed repeated bool,45"`
FixedRepeatedString [3]string `canoto:"fixed repeated string,46"`
FixedBytes [32]byte `canoto:"fixed bytes,47"`
RepeatedFixedBytes [][32]byte `canoto:"repeated fixed bytes,48"`
FixedRepeatedBytes [3][]byte `canoto:"fixed repeated bytes,49"`
FixedRepeatedFixedBytes [3][32]byte `canoto:"fixed repeated fixed bytes,50"`
FixedRepeatedLargestFieldNumber [3]LargestFieldNumber[uint32] `canoto:"fixed repeated value,51"`
ConstRepeatedUint64 [constRepeatedUint64Len]uint64 `canoto:"fixed repeated uint,52"`
CustomType big.Int `canoto:"value,53"`
CustomUint32 customUint32 `canoto:"fint32,54"`
CustomString customString `canoto:"string,55"`
CustomBytes customBytes `canoto:"bytes,56"`
CustomFixedBytes customFixedBytes `canoto:"fixed bytes,57"`
CustomRepeatedBytes customRepeatedBytes `canoto:"repeated bytes,58"`
CustomRepeatedFixedBytes customRepeatedFixedBytes `canoto:"repeated fixed bytes,59"`
CustomFixedRepeatedBytes customFixedRepeatedBytes `canoto:"fixed repeated bytes,60"`
CustomFixedRepeatedFixedBytes customFixedRepeatedFixedBytes `canoto:"fixed repeated fixed bytes,61"`
OneOf OneOf `canoto:"value,62"`
Pointer *LargestFieldNumber[uint32] `canoto:"pointer,63"`
RepeatedPointer []*LargestFieldNumber[uint32] `canoto:"repeated pointer,64"`
FixedRepeatedPointer [3]*LargestFieldNumber[uint32] `canoto:"fixed repeated pointer,65"`
Field *LargestFieldNumber[uint32] `canoto:"field,66"`
RepeatedField []*LargestFieldNumber[uint32] `canoto:"repeated field,67"`
FixedRepeatedField [3]*LargestFieldNumber[uint32] `canoto:"fixed repeated field,68"`
// contains filtered or unexported fields
}
func (*Scalars) CachedCanotoSize ¶
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*Scalars) CalculateCanotoCache ¶
func (c *Scalars) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*Scalars) CanotoSpec ¶ added in v0.13.1
CanotoSpec returns the specification of this canoto message.
func (*Scalars) MakeCanoto ¶ added in v0.7.0
MakeCanoto creates a new empty value.
func (*Scalars) MarshalCanoto ¶
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*Scalars) MarshalCanotoInto ¶
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*Scalars) UnmarshalCanoto ¶
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*Scalars) UnmarshalCanotoFrom ¶
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*Scalars) ValidCanoto ¶
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.
type SpecUnusedZero ¶ added in v0.13.3
type SpecUnusedZero struct {
Bool bool `canoto:"bool,1"`
RepeatedBool []bool `canoto:"repeated bool,2"`
String string `canoto:"string,3"`
RepeatedString []string `canoto:"repeated string,4"`
Bytes []byte `canoto:"bytes,5"`
RepeatedBytes [][]byte `canoto:"repeated bytes,6"`
// contains filtered or unexported fields
}
func (*SpecUnusedZero) CachedCanotoSize ¶ added in v0.13.3
func (c *SpecUnusedZero) CachedCanotoSize() uint64
CachedCanotoSize returns the previously calculated size of the Canoto representation from CalculateCanotoCache.
If CalculateCanotoCache has not yet been called, it will return 0.
If the struct has been modified since the last call to CalculateCanotoCache, the returned size may be incorrect.
func (*SpecUnusedZero) CalculateCanotoCache ¶ added in v0.13.3
func (c *SpecUnusedZero) CalculateCanotoCache()
CalculateCanotoCache populates size and OneOf caches based on the current values in the struct.
It is not safe to copy this struct concurrently.
func (*SpecUnusedZero) CanotoSpec ¶ added in v0.13.3
func (*SpecUnusedZero) CanotoSpec(...reflect.Type) *canoto.Spec
CanotoSpec returns the specification of this canoto message.
func (*SpecUnusedZero) MakeCanoto ¶ added in v0.13.3
func (*SpecUnusedZero) MakeCanoto() *SpecUnusedZero
MakeCanoto creates a new empty value.
func (*SpecUnusedZero) MarshalCanoto ¶ added in v0.13.3
func (c *SpecUnusedZero) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*SpecUnusedZero) MarshalCanotoInto ¶ added in v0.13.3
func (c *SpecUnusedZero) MarshalCanotoInto(w canoto.Writer) canoto.Writer
MarshalCanotoInto writes the struct into a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CalculateCanotoCache has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
It is not safe to copy this struct concurrently.
func (*SpecUnusedZero) UnmarshalCanoto ¶ added in v0.13.3
func (c *SpecUnusedZero) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*SpecUnusedZero) UnmarshalCanotoFrom ¶ added in v0.13.3
func (c *SpecUnusedZero) UnmarshalCanotoFrom(r canoto.Reader) error
UnmarshalCanotoFrom populates the struct from a [canoto.Reader]. Most users should just use UnmarshalCanoto.
During parsing, the canoto cache is saved.
This function enables configuration of reader options.
func (*SpecUnusedZero) ValidCanoto ¶ added in v0.13.3
func (c *SpecUnusedZero) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
Specifically, ValidCanoto ensures: 1. All OneOfs are specified at most once. 2. All strings are valid utf-8. 3. All custom fields are ValidCanoto.