package frob
import "cuelang.org/go/internal/golangorgx/gopls/util/frob"
Package frob is a fast restricted object encoder/decoder in the spirit of encoding/gob.
As with gob, types that recursively contain functions, channels, and unsafe.Pointers cannot be encoded, but frob has these additional restrictions:
Interface values are not supported; this avoids the need for the encoding to describe types.
Types that recursively contain private struct fields are not permitted.
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.
Values are serialized as trees, not graphs, so shared subgraphs are encoded repeatedly.
No attempt is made to detect cyclic data structures.
Index ¶
Types ¶
type Codec ¶
type Codec[T any] struct { // contains filtered or unexported fields }
A Codec[T] is an immutable encoder and decoder for values of type T.
func CodecFor ¶
CodecFor[T] returns a codec for values of type T. It panics if type T is unsuitable.
func (Codec[T]) Decode ¶
func (Codec[T]) Encode ¶
Source Files ¶
frob.go
- Version
- v0.12.0 (latest)
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 8 hours ago –
Tools for package owners.