frob

package
v0.13.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package frob is a fast restricted object encoder/decoder in the spirit of gob. Restrictions include:

  • Interface values are not supported. This avoids the need for the encoding to describe types.

  • The encoding is unspecified and subject to change, so the encoder and decoder must exactly agree on their implementation and on the definitions of the target types.

  • Lengths (of arrays, slices, and maps) are currently assumed to fit in 32 bits.

  • There is no error handling. All errors are reported by panicking.

  • Types that (recursively) contain private struct fields are not permitted.

  • Values are serialized as trees, not graphs, so shared subgraphs are encoded repeatedly.

  • No attempt is made to detect cyclic data structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

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

A Codec is an immutable encoder and decoder for values of a particular type.

func CodecFor117

func CodecFor117(x any) Codec

Use CodecFor117(new(T)) to create a codec for values of type T. Then call Encode(T) and Decode(data, *T). This is a placeholder for the forthcoming generic API -- see below. CodecFor117 panics if type T is unsuitable.

func (Codec) Decode

func (fr Codec) Decode(data []byte, ptr any)

func (Codec) Encode

func (fr Codec) Encode(v any) []byte

Jump to

Keyboard shortcuts

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