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:

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

func CodecFor[T any]() Codec[T]

CodecFor[T] returns a codec for values of type T. It panics if type T is unsuitable.

func (Codec[T]) Decode

func (codec Codec[T]) Decode(data []byte, ptr *T)

func (Codec[T]) Encode

func (codec Codec[T]) Encode(v T) []byte

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.