gotools/gopls/internal/util/frob/frob.go

type Codec

// CodecFor[T] returns a codec for values of type T.
// It panics if type T is unsuitable.
func CodecFor[T any]() Codec[T] {}

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

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

var frobsMu

var frobs

type frob

// frobFor returns the frob for a particular type.
// Precondition: caller holds frobsMu.
func frobFor(t reflect.Type) *frob {}

func (fr *frob) addElem(t reflect.Type) {}

const magic

func (fr *frob) Encode(v any) []byte {}

// encode appends the encoding of value v, whose type must be fr.t.
func (fr *frob) encode(out *writer, v reflect.Value) {}

func (fr *frob) Decode(data []byte, ptr any) {}

// decode reads from in, decodes a value, and sets addr to it.
// addr must be a zero-initialized addressable variable of type fr.t.
func (fr *frob) decode(in *reader, addr reflect.Value) {}

var le

type reader

func (r *reader) uint8() uint8 {}

func (r *reader) uint16() uint16 {}

func (r *reader) uint32() uint32 {}

func (r *reader) uint64() uint64 {}

func (r *reader) bytes(n int) []byte {}

type writer

func (w *writer) uint8(v uint8)   {}

func (w *writer) uint16(v uint16) {}

func (w *writer) uint32(v uint32) {}

func (w *writer) uint64(v uint64) {}

func (w *writer) bytes(v []byte)  {}