wire

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append[T comparable](b []byte, x T) ([]byte, error)

func AppendBool

func AppendBool(b []byte, x bool) []byte

func AppendComplex128

func AppendComplex128(b []byte, x complex128) []byte

func AppendComplex64

func AppendComplex64(b []byte, x complex64) []byte

func AppendFloat32

func AppendFloat32(b []byte, x float32) []byte

func AppendFloat64

func AppendFloat64(b []byte, x float64) []byte

func AppendInt

func AppendInt(b []byte, x int) []byte

func AppendInt16

func AppendInt16(b []byte, x int16) []byte

func AppendInt32

func AppendInt32(b []byte, x int32) []byte

func AppendInt64

func AppendInt64(b []byte, x int64) []byte

func AppendInt8

func AppendInt8(b []byte, x int8) []byte

func AppendMap

func AppendMap[K comparable, V comparable, T ~map[K]V](b []byte, m T) ([]byte, error)

func AppendPair

func AppendPair[T0, T1 comparable](b []byte, x Pair[T0, T1]) ([]byte, error)

func AppendSeq

func AppendSeq[T0 comparable](b []byte, seq iter.Seq[T0]) ([]byte, error)

func AppendSeq2

func AppendSeq2[T0, T1 comparable](b []byte, seq iter.Seq2[T0, T1]) ([]byte, error)

func AppendSlice

func AppendSlice[E comparable, T ~[]E](b []byte, x T) ([]byte, error)

func AppendSortedMap

func AppendSortedMap[K comparable, V comparable, T ~map[K]V](b []byte, m T) ([]byte, error)

func AppendSpan

func AppendSpan[T comparable](b []byte, x T) ([]byte, error)

func AppendStruct

func AppendStruct[T comparable](b []byte, x T) ([]byte, error)

func AppendTriple

func AppendTriple[T0, T1, T2 comparable](b []byte, x Triple[T0, T1, T2]) ([]byte, error)

func AppendUint

func AppendUint(b []byte, x uint) []byte

func AppendUint16

func AppendUint16(b []byte, x uint16) []byte

func AppendUint32

func AppendUint32(b []byte, x uint32) []byte

func AppendUint64

func AppendUint64(b []byte, x uint64) []byte

func AppendUint8

func AppendUint8(b []byte, x uint8) []byte

func AppendUvarint

func AppendUvarint(b []byte, x uint64) []byte

func AppendVarint

func AppendVarint(b []byte, x int64) []byte

func IsFixed

func IsFixed[T any](x any) bool

func Size

func Size[T any](e T) int

func SizeFixed

func SizeFixed[T comparable](x T) (int, bool)

func SizeMap

func SizeMap[K comparable, V comparable, T ~map[K]V](m T) int

func SizeSlice

func SizeSlice[E comparable, T ~[]E](x T) int

func SizeUvarint

func SizeUvarint(x uint64) int

func SizeVarint

func SizeVarint(x int64) int

func SortMultiTable

func SortMultiTable[K, V cmp.Ordered](table []OrderedPair[K, V])

Sort the multi mapped table based on the given cmp function which may implement multimap sorting.

func SortMultiTableFunc

func SortMultiTableFunc[K, V cmp.Ordered](table []OrderedPair[K, V], cmp func(a, b OrderedPair[K, V]) int)

Sort the multi mapped table based on the given cmp function which may implement multimap sorting.

func SortTable

func SortTable[K cmp.Ordered, V comparable](table []PartialOrderedPair[K, V])

SortTable sorts the table based on the given cmp function which may implement multimap sorting.

func SortTableFunc

func SortTableFunc[K cmp.Ordered, V comparable](table []PartialOrderedPair[K, V], cmp func(a, b K) int)

SortTableFunc sorts the table based on the given cmp function which may implement multimap sorting.

func SpanSeq

func SpanSeq[E comparable](x iter.Seq[E]) iter.Seq[Span[E]]

func SpanSeqSlice

func SpanSeqSlice[E comparable, T ~[]E](x T) iter.Seq[Span[E]]

Types

type OrderedPair

type OrderedPair[T0, T1 cmp.Ordered] struct {
	E0 T0
	E1 T1
}

func CompactMultiTable

func CompactMultiTable[K, V cmp.Ordered](table []OrderedPair[K, V]) []OrderedPair[K, V]

CompactMultiTable sorts the table entries and compacts equal keys and values.

CompactMultiTable removes duplicate (K, V) entries.

func CompactMultiTableFunc

func CompactMultiTableFunc[K, V cmp.Ordered](t []OrderedPair[K, V], cmp func(a, b OrderedPair[K, V]) int) []OrderedPair[K, V]

CompactMultiTableFunc sorts the table entries and compacts equal keys and values.

CompactMultiTableFunc removes duplicate (K, V) entries.

type Pair

type Pair[T0, T1 comparable] struct {
	E0 T0
	E1 T1
}

func AppendPairs

func AppendPairs[T0, T1 comparable](pairs []Pair[T0, T1], seq iter.Seq2[T0, T1]) []Pair[T0, T1]

func CollectPairs

func CollectPairs[T0, T1 comparable](seq iter.Seq2[T0, T1]) []Pair[T0, T1]

type PartialOrderedPair

type PartialOrderedPair[T0 cmp.Ordered, T1 comparable] struct {
	E0 T0
	E1 T1
}

func CompactTable

func CompactTable[K cmp.Ordered, V comparable](table []PartialOrderedPair[K, V]) []PartialOrderedPair[K, V]

CompactTable sorts the table entries and compacts equal keys.

CompactTable removes multiple values for the same key, only keeping the first.

func CompactTableFunc

func CompactTableFunc[K cmp.Ordered, V comparable](table []PartialOrderedPair[K, V], cmp func(a, b K) int) []PartialOrderedPair[K, V]

CompactTableFunc sorts the table entries and compacts equal keys.

CompactTableFunc removes multiple values for the same key, only keeping the first.

type Span

type Span[E comparable] struct{ E E }

type Triple

type Triple[T0, T1, T2 comparable] struct {
	E0 T0
	E1 T1
	E2 T2
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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