tlb

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 7 Imported by: 52

README

Serialization and deserialization of data described by TL-B schemas.

This library implements Marshaling and Unmarshaling for TL-B data and some primitives.

TL-B description you can find here:

Usage

Example

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidTag = errors.New("invalid tag")

Functions

func Marshal

func Marshal(c *boc.Cell, o any) error

func Unmarshal

func Unmarshal(c *boc.Cell, o any) error

Types

type Any

type Any boc.Cell

func (Any) MarshalTLB

func (a Any) MarshalTLB(c *boc.Cell, tag string) error

func (*Any) UnmarshalTLB

func (a *Any) UnmarshalTLB(c *boc.Cell, tag string) error

type BinTree

type BinTree[T any] struct {
	Values []T
}

func (BinTree[T]) MarshalTLB

func (b BinTree[T]) MarshalTLB(c *boc.Cell, tag string) error

func (*BinTree[T]) UnmarshalTLB

func (b *BinTree[T]) UnmarshalTLB(c *boc.Cell, tag string) error

type Either

type Either[M, N any] struct {
	IsRight bool
	Left    M
	Right   N
}

func (Either[_, _]) MarshalTLB

func (m Either[_, _]) MarshalTLB(c *boc.Cell, tag string) error

func (*Either[_, _]) UnmarshalTLB

func (m *Either[_, _]) UnmarshalTLB(c *boc.Cell, tag string) error

type EitherRef

type EitherRef[T any] struct {
	IsRight bool
	Value   T
}

func (EitherRef[_]) MarshalTLB

func (m EitherRef[_]) MarshalTLB(c *boc.Cell, tag string) error

func (*EitherRef[_]) UnmarshalTLB

func (m *EitherRef[_]) UnmarshalTLB(c *boc.Cell, tag string) error

type HashMapAugExtraList

type HashMapAugExtraList[T any] struct {
	Left  *HashMapAugExtraList[T]
	Right *HashMapAugExtraList[T]
	Data  T
}

type Hashmap

type Hashmap[T any] struct {
	// contains filtered or unexported fields
}

func (Hashmap[T]) Keys

func (h Hashmap[T]) Keys() []boc.BitString

func (Hashmap[T]) MarshalTLB

func (h Hashmap[T]) MarshalTLB(c *boc.Cell, tag string) error

func (*Hashmap[T]) UnmarshalTLB

func (h *Hashmap[T]) UnmarshalTLB(c *boc.Cell, tag string) error

func (Hashmap[T]) Values

func (h Hashmap[T]) Values() []T

type HashmapAug

type HashmapAug[T1, T2 any] struct {
	// contains filtered or unexported fields
}

func (*HashmapAug[T1, T2]) UnmarshalTLB

func (h *HashmapAug[T1, T2]) UnmarshalTLB(c *boc.Cell, tag string) error

func (HashmapAug[T1, T2]) Values

func (h HashmapAug[T1, T2]) Values() []T1

Values returns a list of value of this hashmap.

type HashmapAugE

type HashmapAugE[T1, T2 any] struct {
	// contains filtered or unexported fields
}

func (HashmapAugE[T1, T2]) Keys

func (h HashmapAugE[T1, T2]) Keys() []boc.BitString

func (*HashmapAugE[T1, T2]) UnmarshalTLB

func (h *HashmapAugE[T1, T2]) UnmarshalTLB(c *boc.Cell, tag string) error

func (HashmapAugE[T1, T2]) Values

func (h HashmapAugE[T1, T2]) Values() []T1

type HashmapE

type HashmapE[T any] struct {
	// contains filtered or unexported fields
}

func (HashmapE[T]) Items

func (h HashmapE[T]) Items() []HashmapItem[T]

Items returns key-value pairs of this hashmap.

func (HashmapE[T]) Keys

func (h HashmapE[T]) Keys() []boc.BitString

func (HashmapE[T]) MarshalTLB

func (h HashmapE[T]) MarshalTLB(c *boc.Cell, tag string) error

func (*HashmapE[T]) UnmarshalTLB

func (h *HashmapE[T]) UnmarshalTLB(c *boc.Cell, tag string) error

func (HashmapE[T]) Values

func (h HashmapE[T]) Values() []T

type HashmapItem

type HashmapItem[T any] struct {
	Key   boc.BitString
	Value T
}

HashmapItem represents a key-value pair stored in HashmapE[T].

type Magic

type Magic uint32

func (Magic) MarshalTLB

func (m Magic) MarshalTLB(c *boc.Cell, tag string) error

func (*Magic) UnmarshalTLB

func (m *Magic) UnmarshalTLB(c *boc.Cell, tag string) error

type MarshalerTLB

type MarshalerTLB interface {
	MarshalTLB(c *boc.Cell, tag string) error
}

type Maybe

type Maybe[T any] struct {
	Null  bool
	Value T
}

func (Maybe[_]) MarshalTLB

func (m Maybe[_]) MarshalTLB(c *boc.Cell, tag string) error

func (*Maybe[_]) UnmarshalTLB

func (m *Maybe[_]) UnmarshalTLB(c *boc.Cell, tag string) error

type Ref

type Ref[T any] struct {
	Value T
}

func (Ref[_]) MarshalTLB

func (m Ref[_]) MarshalTLB(c *boc.Cell, tag string) error

func (*Ref[_]) UnmarshalTLB

func (m *Ref[_]) UnmarshalTLB(c *boc.Cell, tag string) error

type SumType

type SumType string

type Unary

type Unary uint

func (Unary) MarshalTLB

func (n Unary) MarshalTLB(c *boc.Cell, tag string) error

func (*Unary) UnmarshalTLB

func (n *Unary) UnmarshalTLB(c *boc.Cell, tag string) error

type UnmarshalerTLB

type UnmarshalerTLB interface {
	UnmarshalTLB(c *boc.Cell, tag string) error
}

type VarUInteger

type VarUInteger big.Int

func (VarUInteger) MarshalTLB

func (u VarUInteger) MarshalTLB(c *boc.Cell, tag string) error

func (*VarUInteger) UnmarshalTLB

func (u *VarUInteger) UnmarshalTLB(c *boc.Cell, tag string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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