encoding

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DAGCBORDecodeOptions added in v0.3.0

func DAGCBORDecodeOptions() cbor.DecodeOptions

DAGCBORDecodeOptions returns the shared refmt decode strictness used for DAG-CBOR data model decoding.

Types

type Marshaller

type Marshaller struct {
	// contains filtered or unexported fields
}

Marshaller is a reusbale CBOR marshaller.

func NewMarshallerAtlased

func NewMarshallerAtlased(atl atlas.Atlas) *Marshaller

NewMarshallerAtlased constructs a new cbor Marshaller using the given atlas.

func (*Marshaller) Encode

func (m *Marshaller) Encode(obj interface{}, w io.Writer) error

Encode encodes the given object to the given writer.

func (*Marshaller) Marshal

func (m *Marshaller) Marshal(obj interface{}) ([]byte, error)

Marshal marshels the given object to a byte slice.

type PooledCloner

type PooledCloner struct {
	// contains filtered or unexported fields
}

PooledCloner is a thread-safe pooled object cloner.

func NewPooledCloner

func NewPooledCloner(atl atlas.Atlas) PooledCloner

NewPooledCloner returns a PooledCloner with the given atlas. Do not copy after use.

func (*PooledCloner) Clone

func (p *PooledCloner) Clone(a, b interface{}) error

Clone clones a into b using a cloner from the pool.

type PooledMarshaller

type PooledMarshaller struct {
	// contains filtered or unexported fields
}

PooledMarshaller is a thread-safe pooled CBOR marshaller.

func NewPooledMarshaller

func NewPooledMarshaller(atl atlas.Atlas) PooledMarshaller

NewPooledMarshaller returns a PooledMarshaller with the given atlas. Do not copy after use.

func (*PooledMarshaller) Encode

func (p *PooledMarshaller) Encode(obj interface{}, w io.Writer) error

Encode encodes the passed object to the given writer using the pool of marshallers.

func (*PooledMarshaller) Marshal

func (p *PooledMarshaller) Marshal(obj interface{}) ([]byte, error)

Marshal marshals the passed object using the pool of marshallers.

type PooledUnmarshaller

type PooledUnmarshaller struct {
	// contains filtered or unexported fields
}

PooledUnmarshaller is a thread-safe pooled CBOR unmarshaller.

func NewPooledUnmarshaller

func NewPooledUnmarshaller(atl atlas.Atlas) PooledUnmarshaller

NewPooledUnmarshaller returns a PooledUnmarshaller with the given atlas. Do not copy after use.

func (*PooledUnmarshaller) Decode

func (p *PooledUnmarshaller) Decode(r io.Reader, obj interface{}) error

Decode decodes an object from the passed reader into the given object using the pool of unmarshallers.

func (*PooledUnmarshaller) Unmarshal

func (p *PooledUnmarshaller) Unmarshal(b []byte, obj interface{}) error

Unmarshal unmarshals the passed object using the pool of unmarshallers.

type Unmarshaller

type Unmarshaller struct {
	// contains filtered or unexported fields
}

Unmarshaller is a reusable CBOR unmarshaller.

func NewUnmarshallerAtlased

func NewUnmarshallerAtlased(atl atlas.Atlas) *Unmarshaller

NewUnmarshallerAtlased creates a new reusable unmarshaller.

func (*Unmarshaller) Decode

func (m *Unmarshaller) Decode(r io.Reader, obj interface{}) (err error)

Decode reads a CBOR object from the given reader and decodes it into the given object.

func (*Unmarshaller) Unmarshal

func (m *Unmarshaller) Unmarshal(b []byte, obj interface{}) error

Unmarshal unmarshals the given CBOR byte slice into the given object.

Jump to

Keyboard shortcuts

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