Documentation
¶
Index ¶
- Variables
- func Append(dst []byte, v Serializable, boxed bool) ([]byte, error)
- func AppendBytes(dst []byte, data []byte) ([]byte, error)
- func CRC(schema string) uint32
- func FromBytes(data []byte) (loaded []byte, buffer []byte, err error)
- func FromBytesNoCopy(data []byte) (loaded []byte, buffer []byte, err error)
- func Hash(key any) ([]byte, error)
- func Parse(v Serializable, data []byte, boxed bool) (_ []byte, err error)
- func ParseNoCopy(v Serializable, data []byte, boxed bool) ([]byte, error)
- func Register(typ any, tl string) uint32
- func RegisterAllowedGroup(name string, names ...string)
- func RegisterWithFabric(typ any, tl string, fab func() reflect.Value) uint32
- func RemapBufferAsSlice(buf *bytes.Buffer, from int)
- func RemapSliceAsTLBytes(dst []byte, from int) []byte
- func Serialize(v Serializable, boxed bool, bufOpt ...*bytes.Buffer) ([]byte, error)
- func ToBytesToBuffer(buf *bytes.Buffer, data []byte) error
- type ParseableTL
- type Raw
- type Serializable
- type SerializableTL
- type TL
Constants ¶
This section is empty.
Variables ¶
var DefaultSerializeBufferSize = 1024
var Logger = func(a ...any) {}
var MaxVectorAllocationBytes = 256 << 20
MaxVectorAllocationBytes limits memory allocated for vector slice storage. Set it to 0 or a negative value to disable the limit.
var MaxVectorElements = 1 << 20
MaxVectorElements limits vector element count accepted from untrusted TL input. Set it to 0 or a negative value to disable the limit.
Functions ¶
func Append ¶ added in v1.18.0
func Append(dst []byte, v Serializable, boxed bool) ([]byte, error)
Append serializes v and appends the TL bytes to dst.
func AppendBytes ¶ added in v1.18.0
AppendBytes appends data as a TL bytes field.
func FromBytesNoCopy ¶ added in v1.18.0
FromBytesNoCopy reads TL bytes and returns a slice pointing into data. The caller must keep data immutable and alive while loaded is used.
func Parse ¶ added in v1.5.0
func Parse(v Serializable, data []byte, boxed bool) (_ []byte, err error)
func ParseNoCopy ¶ added in v1.18.0
func ParseNoCopy(v Serializable, data []byte, boxed bool) ([]byte, error)
ParseNoCopy parses TL data without copying byte payloads when possible. The caller must keep data immutable and alive while the parsed value is used.
func RegisterAllowedGroup ¶ added in v1.15.0
RegisterAllowedGroup - register an alias for a group of types to use in tl tags in [brackets] In case the name is already registered, types will be appended
func RegisterWithFabric ¶ added in v1.14.0
func RemapBufferAsSlice ¶ added in v1.11.0
func RemapSliceAsTLBytes ¶ added in v1.18.0
Types ¶
type ParseableTL ¶ added in v1.11.0
type Serializable ¶ added in v1.5.0
type Serializable interface{}
type SerializableTL ¶ added in v1.11.0
type TL ¶ added in v1.5.0
type TL interface {
ParseableTL
SerializableTL
}