Documentation
¶
Index ¶
- Constants
- type A
- func (c *A) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *A) CacheCanoto()
- func (c *A) CheckCanoto() bool
- func (*A) DescribeCanoto(...reflect.Type) *canoto.Spec
- func (c *A) MarshalCanoto() []byte
- func (c *A) SizeCanoto() uint64
- func (c *A) UnmarshalCanoto(bytes []byte) error
- func (c *A) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *A) ValidCanoto() bool
- type A__B
- func (c *A__B) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *A__B) CacheCanoto()
- func (c *A__B) CheckCanoto() bool
- func (*A__B) DescribeCanoto(...reflect.Type) *canoto.Spec
- func (c *A__B) MarshalCanoto() []byte
- func (c *A__B) SizeCanoto() uint64
- func (c *A__B) UnmarshalCanoto(bytes []byte) error
- func (c *A__B) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *A__B) ValidCanoto() bool
- type A__Pointer
- func (c *A__Pointer) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *A__Pointer) CacheCanoto()
- func (c *A__Pointer) CheckCanoto() bool
- func (*A__Pointer) DescribeCanoto(...reflect.Type) *canoto.Spec
- func (c *A__Pointer) MarshalCanoto() []byte
- func (c *A__Pointer) SizeCanoto() uint64
- func (c *A__Pointer) UnmarshalCanoto(bytes []byte) error
- func (c *A__Pointer) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *A__Pointer) ValidCanoto() bool
- type CustomFormat
- func (c *CustomFormat) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *CustomFormat) CacheCanoto()
- func (c *CustomFormat) CheckCanoto() bool
- func (*CustomFormat) DescribeCanoto(...reflect.Type) *canoto.Spec
- func (c *CustomFormat) MarshalCanoto() []byte
- func (c *CustomFormat) SizeCanoto() uint64
- func (c *CustomFormat) UnmarshalCanoto(bytes []byte) error
- func (c *CustomFormat) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *CustomFormat) ValidCanoto() bool
- func (c *CustomFormat) WhichCanotoFields() CustomFormatFields
- type CustomFormatCache
- type CustomFormatFields
- type Embedded
- func (c *Embedded) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *Embedded) CacheCanoto()
- func (c *Embedded) CheckCanoto() bool
- func (*Embedded) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *Embedded) MarshalCanoto() []byte
- func (c *Embedded) SizeCanoto() uint64
- func (c *Embedded) UnmarshalCanoto(bytes []byte) error
- func (c *Embedded) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *Embedded) ValidCanoto() bool
- type EmptyMessage
- func (c *EmptyMessage) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *EmptyMessage) CacheCanoto()
- func (c *EmptyMessage) CheckCanoto() bool
- func (*EmptyMessage) DescribeCanoto(...reflect.Type) *canoto.Spec
- func (c *EmptyMessage) MarshalCanoto() []byte
- func (c *EmptyMessage) SizeCanoto() uint64
- func (c *EmptyMessage) UnmarshalCanoto(bytes []byte) error
- func (c *EmptyMessage) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *EmptyMessage) ValidCanoto() bool
- type GenericField
- func (c *GenericField[T1, T2]) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *GenericField[T1, T2]) CacheCanoto()
- func (c *GenericField[T1, T2]) CheckCanoto() bool
- func (*GenericField[T1, T2]) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *GenericField[T1, T2]) MarshalCanoto() []byte
- func (c *GenericField[T1, T2]) SizeCanoto() uint64
- func (c *GenericField[T1, T2]) UnmarshalCanoto(bytes []byte) error
- func (c *GenericField[T1, T2]) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *GenericField[T1, T2]) ValidCanoto() bool
- type ImportedName
- func (c *ImportedName[T1, T2]) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *ImportedName[T1, T2]) CacheCanoto()
- func (c *ImportedName[T1, T2]) CheckCanoto() bool
- func (*ImportedName[T1, T2]) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *ImportedName[T1, T2]) MarshalCanoto() []byte
- func (c *ImportedName[T1, T2]) SizeCanoto() uint64
- func (c *ImportedName[T1, T2]) UnmarshalCanoto(bytes []byte) error
- func (c *ImportedName[T1, T2]) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *ImportedName[T1, T2]) ValidCanoto() bool
- type LargestFieldNumber
- func (c *LargestFieldNumber[T1]) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *LargestFieldNumber[T1]) CacheCanoto()
- func (c *LargestFieldNumber[T1]) CheckCanoto() bool
- func (*LargestFieldNumber[T1]) DescribeCanoto(...reflect.Type) *canoto.Spec
- func (c *LargestFieldNumber[T1]) MarshalCanoto() []byte
- func (c *LargestFieldNumber[T1]) SizeCanoto() uint64
- func (c *LargestFieldNumber[T1]) UnmarshalCanoto(bytes []byte) error
- func (c *LargestFieldNumber[T1]) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *LargestFieldNumber[T1]) ValidCanoto() bool
- type NestedGenericField
- func (c *NestedGenericField[T1, T2]) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *NestedGenericField[T1, T2]) CacheCanoto()
- func (c *NestedGenericField[T1, T2]) CheckCanoto() bool
- func (*NestedGenericField[T1, T2]) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *NestedGenericField[T1, T2]) MarshalCanoto() []byte
- func (c *NestedGenericField[T1, T2]) SizeCanoto() uint64
- func (c *NestedGenericField[T1, T2]) UnmarshalCanoto(bytes []byte) error
- func (c *NestedGenericField[T1, T2]) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *NestedGenericField[T1, T2]) ValidCanoto() bool
- type Node
- func (c *Node) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *Node) CacheCanoto()
- func (c *Node) CheckCanoto() bool
- func (*Node) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *Node) MarshalCanoto() []byte
- func (c *Node) SizeCanoto() uint64
- func (c *Node) UnmarshalCanoto(bytes []byte) error
- func (c *Node) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *Node) ValidCanoto() bool
- func (c *Node) WhichCanotoOneOf() uint32
- type OneOf
- func (c *OneOf) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *OneOf) CacheCanoto()
- func (c *OneOf) CheckCanoto() bool
- func (*OneOf) DescribeCanoto(...reflect.Type) *canoto.Spec
- func (c *OneOf) MarshalCanoto() []byte
- func (c *OneOf) SizeCanoto() uint64
- func (c *OneOf) UnmarshalCanoto(bytes []byte) error
- func (c *OneOf) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *OneOf) ValidCanoto() bool
- func (c *OneOf) WhichCanotoA() uint32
- func (c *OneOf) WhichCanotoB() uint32
- type RecursiveA
- func (c *RecursiveA) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *RecursiveA) CacheCanoto()
- func (c *RecursiveA) CheckCanoto() bool
- func (*RecursiveA) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *RecursiveA) MarshalCanoto() []byte
- func (c *RecursiveA) SizeCanoto() uint64
- func (c *RecursiveA) UnmarshalCanoto(bytes []byte) error
- func (c *RecursiveA) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *RecursiveA) ValidCanoto() bool
- type RecursiveB
- func (c *RecursiveB) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *RecursiveB) CacheCanoto()
- func (c *RecursiveB) CheckCanoto() bool
- func (*RecursiveB) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *RecursiveB) MarshalCanoto() []byte
- func (c *RecursiveB) SizeCanoto() uint64
- func (c *RecursiveB) UnmarshalCanoto(bytes []byte) error
- func (c *RecursiveB) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *RecursiveB) ValidCanoto() bool
- type Scalars
- func (c *Scalars) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *Scalars) CacheCanoto()
- func (c *Scalars) CheckCanoto() bool
- func (*Scalars) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *Scalars) MarshalCanoto() []byte
- func (c *Scalars) SizeCanoto() uint64
- func (c *Scalars) UnmarshalCanoto(bytes []byte) error
- func (c *Scalars) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *Scalars) ValidCanoto() bool
- type SpecUnusedZero
- func (c *SpecUnusedZero) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *SpecUnusedZero) CacheCanoto()
- func (c *SpecUnusedZero) CheckCanoto() bool
- func (*SpecUnusedZero) DescribeCanoto(...reflect.Type) *canoto.Spec
- func (c *SpecUnusedZero) MarshalCanoto() []byte
- func (c *SpecUnusedZero) SizeCanoto() uint64
- func (c *SpecUnusedZero) UnmarshalCanoto(bytes []byte) error
- func (c *SpecUnusedZero) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *SpecUnusedZero) ValidCanoto() bool
- type ValueOneOf
- func (c *ValueOneOf) AppendCanoto(w canoto.Writer) canoto.Writer
- func (c *ValueOneOf) CacheCanoto()
- func (c *ValueOneOf) CheckCanoto() bool
- func (*ValueOneOf) DescribeCanoto(types ...reflect.Type) *canoto.Spec
- func (c *ValueOneOf) MarshalCanoto() []byte
- func (c *ValueOneOf) SizeCanoto() uint64
- func (c *ValueOneOf) UnmarshalCanoto(bytes []byte) error
- func (c *ValueOneOf) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, error)
- func (c *ValueOneOf) ValidCanoto() bool
- func (c *ValueOneOf) WhichCanotoType() uint32
Constants ¶
const ( CustomFormatANumber = 1 CustomFormatBNumber = 2 CustomFormatATag = "\x08" // canoto.Tag(CustomFormatANumber, canoto.Varint) CustomFormatBTag = "\x10" // canoto.Tag(CustomFormatBNumber, canoto.Varint) )
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 in generated identifiers like canotoNumber_A__B__C.
func (*A) AppendCanoto ¶ added in v0.20.0
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*A) CacheCanoto ¶ added in v0.20.0
func (c *A) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*A) CheckCanoto ¶ added in v0.20.0
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
func (*A) DescribeCanoto ¶ added in v0.20.0
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
func (*A) MarshalCanoto ¶ added in v0.8.1
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*A) SizeCanoto ¶ added in v0.20.0
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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.
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) AppendCanoto ¶ added in v0.20.0
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*A__B) CacheCanoto ¶ added in v0.20.0
func (c *A__B) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*A__B) CheckCanoto ¶ added in v0.20.0
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
func (*A__B) DescribeCanoto ¶ added in v0.20.0
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
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.
func (*A__B) SizeCanoto ¶ added in v0.20.0
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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.
type A__Pointer ¶ added in v0.18.0
type A__Pointer struct {
C int32 `canoto:"int,1"`
// contains filtered or unexported fields
}
Check for name collisions with __Pointer wrappers.
func (*A__Pointer) AppendCanoto ¶ added in v0.20.0
func (c *A__Pointer) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*A__Pointer) CacheCanoto ¶ added in v0.20.0
func (c *A__Pointer) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*A__Pointer) CheckCanoto ¶ added in v0.20.0
func (c *A__Pointer) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
func (*A__Pointer) DescribeCanoto ¶ added in v0.20.0
func (*A__Pointer) DescribeCanoto(...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
func (*A__Pointer) MarshalCanoto ¶ added in v0.18.0
func (c *A__Pointer) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*A__Pointer) SizeCanoto ¶ added in v0.20.0
func (c *A__Pointer) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
func (*A__Pointer) UnmarshalCanoto ¶ added in v0.18.0
func (c *A__Pointer) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*A__Pointer) UnmarshalCanotoFrom ¶ added in v0.18.0
func (c *A__Pointer) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, 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 (*A__Pointer) ValidCanoto ¶ added in v0.18.0
func (c *A__Pointer) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
type CustomFormat ¶ added in v0.19.0
type CustomFormat struct {
A uint64 `canoto:"uint,1,Fields"`
B uint64 `canoto:"uint,2,Fields"`
// contains filtered or unexported fields
}
func (*CustomFormat) AppendCanoto ¶ added in v0.20.0
func (c *CustomFormat) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*CustomFormat) CacheCanoto ¶ added in v0.20.0
func (c *CustomFormat) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*CustomFormat) CheckCanoto ¶ added in v0.20.0
func (c *CustomFormat) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
func (*CustomFormat) DescribeCanoto ¶ added in v0.20.0
func (*CustomFormat) DescribeCanoto(...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
func (*CustomFormat) MarshalCanoto ¶ added in v0.19.0
func (c *CustomFormat) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*CustomFormat) SizeCanoto ¶ added in v0.20.0
func (c *CustomFormat) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
func (*CustomFormat) UnmarshalCanoto ¶ added in v0.19.0
func (c *CustomFormat) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*CustomFormat) UnmarshalCanotoFrom ¶ added in v0.19.0
func (c *CustomFormat) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, 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 (*CustomFormat) ValidCanoto ¶ added in v0.19.0
func (c *CustomFormat) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
func (*CustomFormat) WhichCanotoFields ¶ added in v0.20.0
func (c *CustomFormat) WhichCanotoFields() CustomFormatFields
WhichCanotoFields returns the previously calculated field number used to represent Fields.
This value is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CacheCanoto.
If the value has not yet been cached, or the struct has been modified since it was last cached, the returned field number may be incorrect.
type CustomFormatCache ¶ added in v0.19.0
type CustomFormatCache struct {
FieldsOneOf uint32
// contains filtered or unexported fields
}
type CustomFormatFields ¶ added in v0.19.0
type CustomFormatFields uint32
CustomFormatFields identifies the field in CustomFormat populating the Fields oneOf.
const ( CustomFormatFieldsUnset CustomFormatFields = 0 CustomFormatFieldsA CustomFormatFields = CustomFormatANumber CustomFormatFieldsB CustomFormatFields = CustomFormatBNumber )
type Embedded ¶ added in v0.8.1
type Embedded struct {
OneOf `canoto:"value,1"`
*LargestFieldNumber[uint32] `canoto:"pointer,2"`
*GenericField[OneOf, *OneOf] `canoto:"pointer,3"`
*big.Int `canoto:"pointer,4"`
// contains filtered or unexported fields
}
func (*Embedded) AppendCanoto ¶ added in v0.20.0
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*Embedded) CacheCanoto ¶ added in v0.20.0
func (c *Embedded) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*Embedded) CheckCanoto ¶ added in v0.20.0
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*Embedded) DescribeCanoto ¶ added in v0.20.0
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
func (*Embedded) MarshalCanoto ¶ added in v0.8.1
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*Embedded) SizeCanoto ¶ added in v0.20.0
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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.
type EmptyMessage ¶ added in v0.18.0
type EmptyMessage struct {
// contains filtered or unexported fields
}
func (*EmptyMessage) AppendCanoto ¶ added in v0.20.0
func (c *EmptyMessage) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*EmptyMessage) CacheCanoto ¶ added in v0.20.0
func (c *EmptyMessage) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*EmptyMessage) CheckCanoto ¶ added in v0.20.0
func (c *EmptyMessage) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
func (*EmptyMessage) DescribeCanoto ¶ added in v0.20.0
func (*EmptyMessage) DescribeCanoto(...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
func (*EmptyMessage) MarshalCanoto ¶ added in v0.18.0
func (c *EmptyMessage) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*EmptyMessage) SizeCanoto ¶ added in v0.20.0
func (c *EmptyMessage) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
func (*EmptyMessage) UnmarshalCanoto ¶ added in v0.18.0
func (c *EmptyMessage) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*EmptyMessage) UnmarshalCanotoFrom ¶ added in v0.18.0
func (c *EmptyMessage) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, 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 (*EmptyMessage) ValidCanoto ¶ added in v0.18.0
func (c *EmptyMessage) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
type GenericField ¶ added in v0.4.0
type GenericField[V any, _ canoto.FieldPointer[V]] 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"` // contains filtered or unexported fields }
func (*GenericField[T1, T2]) AppendCanoto ¶ added in v0.20.0
func (c *GenericField[T1, T2]) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*GenericField[T1, T2]) CacheCanoto ¶ added in v0.20.0
func (c *GenericField[T1, T2]) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*GenericField[T1, T2]) CheckCanoto ¶ added in v0.20.0
func (c *GenericField[T1, T2]) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*GenericField[T1, T2]) DescribeCanoto ¶ added in v0.20.0
func (*GenericField[T1, T2]) DescribeCanoto(types ...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
func (*GenericField[T1, T2]) MarshalCanoto ¶ added in v0.4.0
func (c *GenericField[T1, T2]) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*GenericField[T1, T2]) SizeCanoto ¶ added in v0.20.0
func (c *GenericField[T1, T2]) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
func (*GenericField[T1, T2]) UnmarshalCanoto ¶ added in v0.4.0
func (c *GenericField[T1, T2]) 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]) UnmarshalCanotoFrom ¶ added in v0.4.0
func (c *GenericField[T1, T2]) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, 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]) ValidCanoto ¶ added in v0.4.0
func (c *GenericField[T1, T2]) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
type ImportedName ¶ added in v1.0.0
type ImportedName[V any, _ canoto.FieldPointer[V]] struct { A imported.A `canoto:"value,1"` V imported.V `canoto:"value,2"` // contains filtered or unexported fields }
Check that imported types are not confused with local messages or type parameters with the same name.
func (*ImportedName[T1, T2]) AppendCanoto ¶ added in v1.0.0
func (c *ImportedName[T1, T2]) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*ImportedName[T1, T2]) CacheCanoto ¶ added in v1.0.0
func (c *ImportedName[T1, T2]) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*ImportedName[T1, T2]) CheckCanoto ¶ added in v1.0.0
func (c *ImportedName[T1, T2]) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*ImportedName[T1, T2]) DescribeCanoto ¶ added in v1.0.0
func (*ImportedName[T1, T2]) DescribeCanoto(types ...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
func (*ImportedName[T1, T2]) MarshalCanoto ¶ added in v1.0.0
func (c *ImportedName[T1, T2]) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*ImportedName[T1, T2]) SizeCanoto ¶ added in v1.0.0
func (c *ImportedName[T1, T2]) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
func (*ImportedName[T1, T2]) UnmarshalCanoto ¶ added in v1.0.0
func (c *ImportedName[T1, T2]) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*ImportedName[T1, T2]) UnmarshalCanotoFrom ¶ added in v1.0.0
func (c *ImportedName[T1, T2]) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, 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 (*ImportedName[T1, T2]) ValidCanoto ¶ added in v1.0.0
func (c *ImportedName[T1, T2]) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
type LargestFieldNumber ¶
type LargestFieldNumber[T canoto.Uint] struct { Uint T `canoto:"uint,536870911"` // contains filtered or unexported fields }
func (*LargestFieldNumber[T1]) AppendCanoto ¶ added in v0.20.0
func (c *LargestFieldNumber[T1]) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*LargestFieldNumber[T1]) CacheCanoto ¶ added in v0.20.0
func (c *LargestFieldNumber[T1]) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*LargestFieldNumber[T1]) CheckCanoto ¶ added in v0.20.0
func (c *LargestFieldNumber[T1]) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
func (*LargestFieldNumber[T1]) DescribeCanoto ¶ added in v0.20.0
func (*LargestFieldNumber[T1]) DescribeCanoto(...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
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.
func (*LargestFieldNumber[T1]) SizeCanoto ¶ added in v0.20.0
func (c *LargestFieldNumber[T1]) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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) (canoto.UnmarshalResult, 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.
type NestedGenericField ¶ added in v0.5.0
type NestedGenericField[V any, P canoto.FieldPointer[V]] struct { Value GenericField[V, P] `canoto:"value,1"` RepeatedValue []GenericField[V, P] `canoto:"repeated value,2"` FixedRepeatedValue [3]GenericField[V, P] `canoto:"fixed repeated value,3"` Pointer *GenericField[V, P] `canoto:"pointer,4"` RepeatedPointer []*GenericField[V, P] `canoto:"repeated pointer,5"` FixedRepeatedPointer [3]*GenericField[V, P] `canoto:"fixed repeated pointer,6"` // contains filtered or unexported fields }
func (*NestedGenericField[T1, T2]) AppendCanoto ¶ added in v0.20.0
func (c *NestedGenericField[T1, T2]) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*NestedGenericField[T1, T2]) CacheCanoto ¶ added in v0.20.0
func (c *NestedGenericField[T1, T2]) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*NestedGenericField[T1, T2]) CheckCanoto ¶ added in v0.20.0
func (c *NestedGenericField[T1, T2]) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*NestedGenericField[T1, T2]) DescribeCanoto ¶ added in v0.20.0
func (*NestedGenericField[T1, T2]) DescribeCanoto(types ...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
func (*NestedGenericField[T1, T2]) MarshalCanoto ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2]) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*NestedGenericField[T1, T2]) SizeCanoto ¶ added in v0.20.0
func (c *NestedGenericField[T1, T2]) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
func (*NestedGenericField[T1, T2]) UnmarshalCanoto ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2]) 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]) UnmarshalCanotoFrom ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2]) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, 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]) ValidCanoto ¶ added in v0.5.0
func (c *NestedGenericField[T1, T2]) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
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) AppendCanoto ¶ added in v0.20.0
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*Node) CacheCanoto ¶ added in v0.20.0
func (c *Node) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*Node) CheckCanoto ¶ added in v0.20.0
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*Node) DescribeCanoto ¶ added in v0.20.0
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
func (*Node) MarshalCanoto ¶ added in v0.13.1
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*Node) SizeCanoto ¶ added in v0.20.0
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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.
func (*Node) WhichCanotoOneOf ¶ added in v0.20.0
WhichCanotoOneOf returns the previously calculated field number used to represent OneOf.
This value is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CacheCanoto.
If the value has not yet been cached, or the struct has been modified since it was last cached, the returned field number may be incorrect.
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) AppendCanoto ¶ added in v0.20.0
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*OneOf) CacheCanoto ¶ added in v0.20.0
func (c *OneOf) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*OneOf) CheckCanoto ¶ added in v0.20.0
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
func (*OneOf) DescribeCanoto ¶ added in v0.20.0
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
func (*OneOf) MarshalCanoto ¶
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*OneOf) SizeCanoto ¶ added in v0.20.0
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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.
func (*OneOf) WhichCanotoA ¶ added in v0.20.0
WhichCanotoA returns the previously calculated field number used to represent A.
This value is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CacheCanoto.
If the value has not yet been cached, or the struct has been modified since it was last cached, the returned field number may be incorrect.
func (*OneOf) WhichCanotoB ¶ added in v0.20.0
WhichCanotoB returns the previously calculated field number used to represent B.
This value is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CacheCanoto.
If the value has not yet been cached, or the struct has been modified since it was last cached, the returned field number may be incorrect.
type RecursiveA ¶ added in v0.13.1
type RecursiveA struct {
Next *RecursiveB `canoto:"pointer,1"`
// contains filtered or unexported fields
}
func (*RecursiveA) AppendCanoto ¶ added in v0.20.0
func (c *RecursiveA) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*RecursiveA) CacheCanoto ¶ added in v0.20.0
func (c *RecursiveA) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*RecursiveA) CheckCanoto ¶ added in v0.20.0
func (c *RecursiveA) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*RecursiveA) DescribeCanoto ¶ added in v0.20.0
func (*RecursiveA) DescribeCanoto(types ...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
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.
func (*RecursiveA) SizeCanoto ¶ added in v0.20.0
func (c *RecursiveA) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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) (canoto.UnmarshalResult, 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.
type RecursiveB ¶ added in v0.13.1
type RecursiveB struct {
Next *RecursiveA `canoto:"pointer,1"`
// contains filtered or unexported fields
}
func (*RecursiveB) AppendCanoto ¶ added in v0.20.0
func (c *RecursiveB) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*RecursiveB) CacheCanoto ¶ added in v0.20.0
func (c *RecursiveB) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*RecursiveB) CheckCanoto ¶ added in v0.20.0
func (c *RecursiveB) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*RecursiveB) DescribeCanoto ¶ added in v0.20.0
func (*RecursiveB) DescribeCanoto(types ...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
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.
func (*RecursiveB) SizeCanoto ¶ added in v0.20.0
func (c *RecursiveB) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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) (canoto.UnmarshalResult, 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.
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"`
// contains filtered or unexported fields
}
func (*Scalars) AppendCanoto ¶ added in v0.20.0
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*Scalars) CacheCanoto ¶ added in v0.20.0
func (c *Scalars) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*Scalars) CheckCanoto ¶ added in v0.20.0
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*Scalars) DescribeCanoto ¶ added in v0.20.0
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
func (*Scalars) MarshalCanoto ¶
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*Scalars) SizeCanoto ¶ added in v0.20.0
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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.
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) AppendCanoto ¶ added in v0.20.0
func (c *SpecUnusedZero) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*SpecUnusedZero) CacheCanoto ¶ added in v0.20.0
func (c *SpecUnusedZero) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*SpecUnusedZero) CheckCanoto ¶ added in v0.20.0
func (c *SpecUnusedZero) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
func (*SpecUnusedZero) DescribeCanoto ¶ added in v0.20.0
func (*SpecUnusedZero) DescribeCanoto(...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
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.
func (*SpecUnusedZero) SizeCanoto ¶ added in v0.20.0
func (c *SpecUnusedZero) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
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) (canoto.UnmarshalResult, 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.
type ValueOneOf ¶ added in v0.20.0
type ValueOneOf struct {
Value OneOf `canoto:"value,1,Type"`
Int int32 `canoto:"int,2,Type"`
// contains filtered or unexported fields
}
ValueOneOf verifies that value message fields in a OneOf are only considered set when they are non-zero.
func (*ValueOneOf) AppendCanoto ¶ added in v0.20.0
func (c *ValueOneOf) AppendCanoto(w canoto.Writer) canoto.Writer
AppendCanoto appends the struct to a [canoto.Writer] and returns the resulting [canoto.Writer]. Most users should just use MarshalCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
It is assumed that this struct is ValidCanoto.
func (*ValueOneOf) CacheCanoto ¶ added in v0.20.0
func (c *ValueOneOf) CacheCanoto()
CacheCanoto populates size and OneOf caches based on the current values in the struct.
func (*ValueOneOf) CheckCanoto ¶ added in v0.20.0
func (c *ValueOneOf) CheckCanoto() bool
CheckCanoto validates that the struct can be correctly marshaled into the Canoto format. Most users should just use ValidCanoto.
It is assumed that CacheCanoto has been called since the last modification to this struct.
func (*ValueOneOf) DescribeCanoto ¶ added in v0.20.0
func (*ValueOneOf) DescribeCanoto(types ...reflect.Type) *canoto.Spec
DescribeCanoto returns a [canoto.Spec] describing the fields of this message and their wire types.
types is used as a stack of ancestor messages to detect recursive specs.
func (*ValueOneOf) MarshalCanoto ¶ added in v0.20.0
func (c *ValueOneOf) MarshalCanoto() []byte
MarshalCanoto returns the Canoto representation of this struct.
It is assumed that this struct is ValidCanoto.
func (*ValueOneOf) SizeCanoto ¶ added in v0.20.0
func (c *ValueOneOf) SizeCanoto() uint64
SizeCanoto returns the previously calculated size of the Canoto representation from CacheCanoto.
If CacheCanoto has not yet been called, or the struct has been modified since the last call to CacheCanoto, the returned size may be incorrect.
func (*ValueOneOf) UnmarshalCanoto ¶ added in v0.20.0
func (c *ValueOneOf) UnmarshalCanoto(bytes []byte) error
UnmarshalCanoto unmarshals a Canoto-encoded byte slice into the struct.
During parsing, the canoto cache is saved.
func (*ValueOneOf) UnmarshalCanotoFrom ¶ added in v0.20.0
func (c *ValueOneOf) UnmarshalCanotoFrom(r canoto.Reader) (canoto.UnmarshalResult, 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 (*ValueOneOf) ValidCanoto ¶ added in v0.20.0
func (c *ValueOneOf) ValidCanoto() bool
ValidCanoto validates that the struct can be correctly marshaled into the Canoto format.
func (*ValueOneOf) WhichCanotoType ¶ added in v0.20.0
func (c *ValueOneOf) WhichCanotoType() uint32
WhichCanotoType returns the previously calculated field number used to represent Type.
This value is cached by UnmarshalCanoto, UnmarshalCanotoFrom, and CacheCanoto.
If the value has not yet been cached, or the struct has been modified since it was last cached, the returned field number may be incorrect.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package canoto implements a canonical, compact, and fast serialization format that is read-compatible with Protocol Buffers.
|
Package canoto implements a canonical, compact, and fast serialization format that is read-compatible with Protocol Buffers. |
|
Package generate produces canoto serialization code, proto definitions, and standalone library copies from Go source files.
|
Package generate produces canoto serialization code, proto definitions, and standalone library copies from Go source files. |
|
Package imported declares messages whose names collide with identifiers in the examples package, to verify that imported types are not confused with local messages or type parameters.
|
Package imported declares messages whose names collide with identifiers in the examples package, to verify that imported types are not confused with local messages or type parameters. |