bin

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coder

type Coder struct {
	// contains filtered or unexported fields
}
Example
type Foo struct {
	Name string
	ID   int
	mjau string
}

c := NewCoder()

b := binary.NewBufferWriter(1024)

err := c.Encode(b, &Foo{
	Name: "mjau",
})

if err != nil {
	panic(err)
}

fmt.Println(b.Bytes())
Output:

[4 109 106 97 117 0 0 0 0 0 0 0 0]

func NewCoder

func NewCoder(opt ...CoderOptions) *Coder

func (*Coder) Decode

func (c *Coder) Decode(b binary.Reader, v any, nocopy ...bool) (err error)

func (*Coder) Encode

func (c *Coder) Encode(b binary.Writer, v any) (err error)

func (*Coder) TypeHash

func (c *Coder) TypeHash(h hash.Hash, v any) (err error)

type CoderOptions added in v0.2.0

type CoderOptions struct {
	AllowAllocations     bool
	KeepUnexportedFields bool
}

type Type

type Type interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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