sumtree

package
v0.0.0-...-6a4b757 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sumtree is a port of Zed's sum_tree crate: a persistent B+ tree whose nodes cache a summary of their subtree.

Index

Constants

View Source
const TreeBase = 6

TreeBase is the minimum fan-out of a node; a node holds at most 2*TreeBase children. Tests in this package run with a base of 2, as upstream's cfg(test) build does.

Variables

This section is empty.

Functions

func FromSummary

func FromSummary[D Dimension[D, S, C], S any, C any](summary S, cx C) D

FromSummary returns the dimension of summary measured from zero.

func PropertySumTree

func PropertySumTree[T Item[S, struct{}], S Summary[S, struct{}]](values func(*rand.Rand) T, minSize, maxSize int) func(*rand.Rand) SumTree[T, S, struct{}]

PropertySumTree returns a generator of trees with between minSize and maxSize-1 items drawn from values, upstream's proptest `sum_tree` strategy without shrinking.

func WithAddedSummary

func WithAddedSummary[D Dimension[D, S, C], S any, C any](d D, summary S, cx C) D

WithAddedSummary returns d with summary added.

Types

type Bias

type Bias uint8

Bias settles ambiguities when determining positions in an ordered sequence.

const (
	// BiasLeft attaches to the character on the left.
	BiasLeft Bias = iota
	// BiasRight attaches to the character on the right.
	BiasRight
)

func (Bias) Invert

func (b Bias) Invert() Bias

Invert returns the opposite bias.

type ContextLessSummary

type ContextLessSummary[S any] = Summary[S, struct{}]

ContextLessSummary is a Summary whose context is the unit struct.

type Cursor

type Cursor[T Item[S, C], S Summary[S, C], C any, D Dimension[D, S, C]] struct {
	Position D
	// contains filtered or unexported fields
}

Cursor walks a SumTree, tracking its position in dimension D.

func NewCursor

func NewCursor[T Item[S, C], S Summary[S, C], C any, D Dimension[D, S, C]](tree SumTree[T, S, C], cx C) *Cursor[T, S, C, D]

NewCursor returns a cursor over tree that has not yet seeked.

func (*Cursor[T, S, C, D]) All

func (c *Cursor[T, S, C, D]) All() iter.Seq[T]

All iterates the remaining items, advancing the cursor, as upstream's Iterator impl.

func (*Cursor[T, S, C, D]) Clone

func (c *Cursor[T, S, C, D]) Clone() *Cursor[T, S, C, D]

Clone returns an independent copy of the cursor.

func (*Cursor[T, S, C, D]) DidSeek

func (c *Cursor[T, S, C, D]) DidSeek() bool

DidSeek reports whether the cursor has been positioned.

func (*Cursor[T, S, C, D]) End

func (c *Cursor[T, S, C, D]) End() D

End returns the position at the end of the current item.

func (*Cursor[T, S, C, D]) Item

func (c *Cursor[T, S, C, D]) Item() (T, bool)

Item returns the current item; ok is false when the tree is empty or the cursor is at the end.

func (*Cursor[T, S, C, D]) ItemSummary

func (c *Cursor[T, S, C, D]) ItemSummary() (S, bool)

ItemSummary returns the summary of the current item.

func (*Cursor[T, S, C, D]) Next

func (c *Cursor[T, S, C, D]) Next()

Next moves to the next item.

func (*Cursor[T, S, C, D]) NextItem

func (c *Cursor[T, S, C, D]) NextItem() (T, bool)

NextItem returns the item after the current one.

func (*Cursor[T, S, C, D]) Prev

func (c *Cursor[T, S, C, D]) Prev()

Prev moves to the previous item.

func (*Cursor[T, S, C, D]) PrevItem

func (c *Cursor[T, S, C, D]) PrevItem() (T, bool)

PrevItem returns the item before the current one.

func (*Cursor[T, S, C, D]) Reset

func (c *Cursor[T, S, C, D]) Reset()

Reset returns the cursor to its unseeked state.

func (*Cursor[T, S, C, D]) SearchBackward

func (c *Cursor[T, S, C, D]) SearchBackward(filterNode func(S) bool)

SearchBackward moves to the previous item whose subtree summaries satisfy filterNode.

func (*Cursor[T, S, C, D]) SearchForward

func (c *Cursor[T, S, C, D]) SearchForward(filterNode func(S) bool)

SearchForward moves to the next item whose subtree summaries satisfy filterNode.

func (*Cursor[T, S, C, D]) Seek

func (c *Cursor[T, S, C, D]) Seek(pos SeekTarget[S, D, C], bias Bias) bool

Seek resets the cursor and moves it to target; it reports whether target was found exactly.

func (*Cursor[T, S, C, D]) SeekForward

func (c *Cursor[T, S, C, D]) SeekForward(pos SeekTarget[S, D, C], bias Bias) bool

SeekForward moves the cursor forward to target; it reports whether target was found exactly.

func (*Cursor[T, S, C, D]) Slice

func (c *Cursor[T, S, C, D]) Slice(end SeekTarget[S, D, C], bias Bias) SumTree[T, S, C]

Slice advances the cursor to end and returns the traversed items as a tree.

func (*Cursor[T, S, C, D]) Start

func (c *Cursor[T, S, C, D]) Start() D

Start returns the position at the start of the current item.

func (*Cursor[T, S, C, D]) Suffix

func (c *Cursor[T, S, C, D]) Suffix() SumTree[T, S, C]

Suffix advances the cursor to the end and returns the traversed items as a tree.

func (*Cursor[T, S, C, D]) Summary

func (c *Cursor[T, S, C, D]) Summary[Output Dimension[Output, S, C]](end SeekTarget[S, D, C], bias Bias) Output

Summary advances the cursor to end and returns the traversed extent in dimension Output.

type Dimension

type Dimension[D any, S any, C any] interface {
	Zero(cx C) D
	AddSummary(summary S, cx C) D
}

Dimension is a quantity measured by a Summary S that can be used to seek in a SumTree. Every Summary is a Dimension of itself.

type Dimensions

type Dimensions[S any, C any, D1 Dimension[D1, S, C], D2 Dimension[D2, S, C], D3 Dimension[D3, S, C]] struct {
	V0 D1
	V1 D2
	V2 D3
}

Dimensions measures up to three dimensions at once.

func (Dimensions[S, C, D1, D2, D3]) AddSummary

func (d Dimensions[S, C, D1, D2, D3]) AddSummary(summary S, cx C) Dimensions[S, C, D1, D2, D3]

AddSummary adds summary to every dimension.

func (Dimensions[S, C, D1, D2, D3]) Zero

func (Dimensions[S, C, D1, D2, D3]) Zero(cx C) Dimensions[S, C, D1, D2, D3]

Zero returns the zero of every dimension.

type DimensionsTarget

type DimensionsTarget[S any, C any, D1 Dimension[D1, S, C], D2 Dimension[D2, S, C], D3 Dimension[D3, S, C]] struct {
	Target SeekTarget[S, D1, C]
}

DimensionsTarget seeks a Dimensions cursor by its first dimension.

func (DimensionsTarget[S, C, D1, D2, D3]) Cmp

func (t DimensionsTarget[S, C, D1, D2, D3]) Cmp(cursorLocation Dimensions[S, C, D1, D2, D3], cx C) int

Cmp compares the target with the first dimension of cursorLocation.

type Edit

type Edit[T any, K any] struct {
	// contains filtered or unexported fields
}

Edit is an insertion of an item or a removal by key, applied by SumTree.Edit.

func EditInsert

func EditInsert[T any, K any](item T) Edit[T, K]

EditInsert returns an edit inserting item.

func EditRemove

func EditRemove[T any, K any](key K) Edit[T, K]

EditRemove returns an edit removing the item with key.

type FilterCursor

type FilterCursor[T Item[S, C], S Summary[S, C], C any, D Dimension[D, S, C]] struct {
	// contains filtered or unexported fields
}

FilterCursor is a Cursor that skips subtrees whose summary fails a filter.

func NewFilterCursor

func NewFilterCursor[T Item[S, C], S Summary[S, C], C any, D Dimension[D, S, C]](tree SumTree[T, S, C], cx C, filterNode func(S) bool) *FilterCursor[T, S, C, D]

NewFilterCursor returns a filter cursor over tree.

func (*FilterCursor[T, S, C, D]) All

func (f *FilterCursor[T, S, C, D]) All() iter.Seq[T]

All iterates the remaining matching items, advancing the cursor.

func (*FilterCursor[T, S, C, D]) End

func (f *FilterCursor[T, S, C, D]) End() D

End returns the position at the end of the current item.

func (*FilterCursor[T, S, C, D]) Item

func (f *FilterCursor[T, S, C, D]) Item() (T, bool)

Item returns the current item.

func (*FilterCursor[T, S, C, D]) ItemSummary

func (f *FilterCursor[T, S, C, D]) ItemSummary() (S, bool)

ItemSummary returns the summary of the current item.

func (*FilterCursor[T, S, C, D]) Next

func (f *FilterCursor[T, S, C, D]) Next()

Next moves to the next matching item.

func (*FilterCursor[T, S, C, D]) Prev

func (f *FilterCursor[T, S, C, D]) Prev()

Prev moves to the previous matching item.

func (*FilterCursor[T, S, C, D]) Start

func (f *FilterCursor[T, S, C, D]) Start() D

Start returns the position at the start of the current item.

type Item

type Item[S any, C any] interface {
	Summary(cx C) S
}

Item is a value stored in a SumTree, summarized by S under context C.

type Iter

type Iter[T Item[S, C], S Summary[S, C], C any] struct {
	// contains filtered or unexported fields
}

Iter iterates the items of a SumTree in order.

func (*Iter[T, S, C]) Last

func (it *Iter[T, S, C]) Last() (T, bool)

Last returns the last item of the tree, consuming the iterator.

func (*Iter[T, S, C]) Next

func (it *Iter[T, S, C]) Next() (T, bool)

Next returns the next item.

func (*Iter[T, S, C]) SizeHint

func (it *Iter[T, S, C]) SizeHint() int

SizeHint returns a lower bound on the number of remaining items.

type KeyedItem

type KeyedItem[S any, C any, K any] interface {
	Item[S, C]
	Key() K
}

KeyedItem is an Item whose summary has a key identifying it.

type MapEntry

type MapEntry[K cmp.Ordered, V any] struct {
	// contains filtered or unexported fields
}

MapEntry is one key-value pair of a TreeMap.

func (MapEntry[K, V]) Key

func (e MapEntry[K, V]) Key() MapKey[K]

Key returns the entry's key.

func (MapEntry[K, V]) Summary

func (e MapEntry[K, V]) Summary(unit) MapKey[K]

Summary returns the entry's key.

type MapKey

type MapKey[K cmp.Ordered] struct {
	// contains filtered or unexported fields
}

MapKey is the summary of a TreeMap subtree: its greatest key, or none.

func (MapKey[K]) AddSummary

func (MapKey[K]) AddSummary(summary MapKey[K], _ unit) MapKey[K]

AddSummary returns summary, the greatest key so far.

func (MapKey[K]) Cmp

func (k MapKey[K]) Cmp(cursorLocation MapKey[K], _ unit) int

Cmp orders keys, the empty key first.

func (MapKey[K]) Zero

func (MapKey[K]) Zero(unit) MapKey[K]

Zero returns the empty key.

type MapKeyRef

type MapKeyRef[K cmp.Ordered] struct {
	// contains filtered or unexported fields
}

MapKeyRef is the key dimension used to seek in a TreeMap.

func (MapKeyRef[K]) AddSummary

func (MapKeyRef[K]) AddSummary(summary MapKey[K], _ unit) MapKeyRef[K]

AddSummary returns the key of summary.

func (MapKeyRef[K]) Cmp

func (k MapKeyRef[K]) Cmp(cursorLocation MapKeyRef[K], _ unit) int

Cmp orders keys, the empty key first.

func (MapKeyRef[K]) Zero

func (MapKeyRef[K]) Zero(unit) MapKeyRef[K]

Zero returns the empty key.

type MapSeekKey

type MapSeekKey[K cmp.Ordered] struct {
	Key K
}

MapSeekKey is a key used as a MapSeekTarget, upstream's blanket impl for `K: Ord`.

func (MapSeekKey[K]) CmpCursor

func (k MapSeekKey[K]) CmpCursor(cursorLocation K) int

CmpCursor compares the key with cursorLocation.

type MapSeekTarget

type MapSeekTarget[K any] interface {
	CmpCursor(cursorLocation K) int
}

MapSeekTarget is a position in a TreeMap's key space.

type NoSummary

type NoSummary struct{}

NoSummary is a catch-all Summary that carries no data.

func (NoSummary) AddSummary

func (NoSummary) AddSummary(NoSummary, struct{}) NoSummary

AddSummary returns NoSummary.

func (NoSummary) Zero

func (NoSummary) Zero(struct{}) NoSummary

Zero returns NoSummary.

type Node

type Node[T Item[S, C], S Summary[S, C], C any] struct {
	// contains filtered or unexported fields
}

Node is one node of a SumTree: internal when it has child trees, a leaf when it has items.

type OrdDimension

type OrdDimension[K any, S any, C any] interface {
	Dimension[K, S, C]
	SeekTarget[S, K, C]
}

OrdDimension is a dimension that is also a seek target for itself, the Go form of upstream's `Dimension + Ord` key bound.

type SeekTarget

type SeekTarget[S any, D any, C any] interface {
	Cmp(cursorLocation D, cx C) int
}

SeekTarget is a position a cursor over dimension D can seek to. Cmp compares the target with the cursor location like cmp.Compare.

type SumTree

type SumTree[T Item[S, C], S Summary[S, C], C any] struct {
	// contains filtered or unexported fields
}

SumTree is a B+ tree whose leaves hold items and whose nodes hold the summary of their subtree. Copying a SumTree is cheap; nodes are shared and copied on write. The zero value is an empty tree under the zero context.

func NewSumTree

func NewSumTree[T Item[S, C], S Summary[S, C], C any](cx C) SumTree[T, S, C]

NewSumTree returns an empty tree.

func SumTreeFromItem

func SumTreeFromItem[T Item[S, C], S Summary[S, C], C any](item T, cx C) SumTree[T, S, C]

SumTreeFromItem returns a tree holding item.

func SumTreeFromIter

func SumTreeFromIter[T Item[S, C], S Summary[S, C], C any](items []T, cx C) SumTree[T, S, C]

SumTreeFromIter builds a tree from items in order.

func SumTreeFromParIter

func SumTreeFromParIter[T Item[S, C], S Summary[S, C], C any](items []T, cx C) SumTree[T, S, C]

SumTreeFromParIter builds a tree from items in chunks, as upstream's parallel constructor does; the Go port runs the chunks sequentially.

func SumTreeFromSummary

func SumTreeFromSummary[T Item[S, C], S Summary[S, C], C any](summary S) SumTree[T, S, C]

SumTreeFromSummary returns an empty tree with the given zero summary.

func (*SumTree[T, S, C]) Append

func (t *SumTree[T, S, C]) Append(other SumTree[T, S, C], cx C)

Append appends every item of other.

func (SumTree[T, S, C]) Cursor

func (t SumTree[T, S, C]) Cursor[D Dimension[D, S, C]](cx C) *Cursor[T, S, C, D]

Cursor returns a cursor over the tree measuring dimension D.

func (*SumTree[T, S, C]) Edit

func (t *SumTree[T, S, C]) Edit[K OrdDimension[K, S, C]](edits []Edit[T, K], cx C) []T

Edit applies edits and returns the items they replaced or removed.

func (*SumTree[T, S, C]) Extend

func (t *SumTree[T, S, C]) Extend(items []T, cx C)

Extend appends items.

func (SumTree[T, S, C]) Extent

func (t SumTree[T, S, C]) Extent[D Dimension[D, S, C]](cx C) D

Extent returns the dimension D of the whole tree.

func (SumTree[T, S, C]) Filter

func (t SumTree[T, S, C]) Filter[U Dimension[U, S, C]](cx C, filterNode func(S) bool) *FilterCursor[T, S, C, U]

Filter returns a cursor that only visits subtrees whose summary satisfies filterNode.

func (SumTree[T, S, C]) Find

func (t SumTree[T, S, C]) Find[D Dimension[D, S, C]](cx C, target SeekTarget[S, D, C], bias Bias) (D, D, T, bool)

Find is a faster Cursor + Seek + Item.

func (SumTree[T, S, C]) FindExact

func (t SumTree[T, S, C]) FindExact[D Dimension[D, S, C]](cx C, target SeekTarget[S, D, C], bias Bias) (D, D, T, bool)

FindExact returns the start and end of the item that exactly matches target, and the item.

func (SumTree[T, S, C]) FindWithPrev

func (t SumTree[T, S, C]) FindWithPrev[D Dimension[D, S, C]](cx C, target SeekTarget[S, D, C], bias Bias) (start D, end D, prev T, hasPrev bool, item T, ok bool)

FindWithPrev is Find that also returns the item before the found one.

func (SumTree[T, S, C]) First

func (t SumTree[T, S, C]) First() (T, bool)

First returns the first item.

func (SumTree[T, S, C]) Get

func (t SumTree[T, S, C]) Get[K OrdDimension[K, S, C]](key K, cx C) (T, bool)

Get returns the item with the given key.

func (*SumTree[T, S, C]) InsertOrReplace

func (t *SumTree[T, S, C]) InsertOrReplace[K OrdDimension[K, S, C]](item T, cx C) (T, bool)

InsertOrReplace inserts item, replacing and returning the item with the same key.

func (SumTree[T, S, C]) IsEmpty

func (t SumTree[T, S, C]) IsEmpty() bool

IsEmpty reports whether the tree holds no items.

func (SumTree[T, S, C]) Items

func (t SumTree[T, S, C]) Items(cx C) []T

Items returns all items in order.

func (SumTree[T, S, C]) Iter

func (t SumTree[T, S, C]) Iter() iter.Seq[T]

Iter returns the items in order.

func (SumTree[T, S, C]) Last

func (t SumTree[T, S, C]) Last() (T, bool)

Last returns the last item.

func (SumTree[T, S, C]) LastSummary

func (t SumTree[T, S, C]) LastSummary() (S, bool)

LastSummary returns the summary of the last item.

func (*SumTree[T, S, C]) ParExtend

func (t *SumTree[T, S, C]) ParExtend(items []T, cx C)

ParExtend appends items through SumTreeFromParIter.

func (*SumTree[T, S, C]) Push

func (t *SumTree[T, S, C]) Push(item T, cx C)

Push appends one item.

func (*SumTree[T, S, C]) Remove

func (t *SumTree[T, S, C]) Remove[K OrdDimension[K, S, C]](key K, cx C) (T, bool)

Remove removes and returns the item with the given key.

func (SumTree[T, S, C]) Summary

func (t SumTree[T, S, C]) Summary() S

Summary returns the summary of the whole tree.

func (*SumTree[T, S, C]) UpdateFirst

func (t *SumTree[T, S, C]) UpdateFirst(f func(*T), cx C)

UpdateFirst applies f to the first item and refreshes the summaries above it.

func (*SumTree[T, S, C]) UpdateLast

func (t *SumTree[T, S, C]) UpdateLast(f func(*T), cx C)

UpdateLast applies f to the last item and refreshes the summaries above it.

type Summary

type Summary[S any, C any] interface {
	Zero(cx C) S
	AddSummary(summary S, cx C) S
}

Summary describes the sum of all items in a subtree. Zero is called on the zero value of S; AddSummary returns the receiver with summary added.

type TreeMap

type TreeMap[K cmp.Ordered, V any] struct {
	// contains filtered or unexported fields
}

TreeMap is a cheaply-copyable ordered map based on a SumTree.

func TreeMapFromOrderedEntries

func TreeMapFromOrderedEntries[K cmp.Ordered, V any](entries iter.Seq2[K, V]) TreeMap[K, V]

TreeMapFromOrderedEntries builds a map from entries already in key order.

func (*TreeMap[K, V]) Clear

func (m *TreeMap[K, V]) Clear()

Clear removes every entry.

func (TreeMap[K, V]) Closest

func (m TreeMap[K, V]) Closest(key K) (K, V, bool)

Closest returns the entry with the greatest key less than or equal to key.

func (TreeMap[K, V]) ContainsKey

func (m TreeMap[K, V]) ContainsKey(key K) bool

ContainsKey reports whether key is present.

func (*TreeMap[K, V]) Extend

func (m *TreeMap[K, V]) Extend(entries iter.Seq2[K, V])

Extend inserts every entry, replacing existing keys.

func (TreeMap[K, V]) First

func (m TreeMap[K, V]) First() (K, V, bool)

First returns the entry with the smallest key.

func (TreeMap[K, V]) Get

func (m TreeMap[K, V]) Get(key K) (V, bool)

Get returns the value stored under key.

func (*TreeMap[K, V]) Insert

func (m *TreeMap[K, V]) Insert(key K, value V)

Insert sets key to value.

func (*TreeMap[K, V]) InsertOrReplace

func (m *TreeMap[K, V]) InsertOrReplace(key K, value V) (V, bool)

InsertOrReplace sets key to value and returns the previous value.

func (*TreeMap[K, V]) InsertTree

func (m *TreeMap[K, V]) InsertTree(other TreeMap[K, V])

InsertTree inserts every entry of other, replacing existing keys.

func (TreeMap[K, V]) IsEmpty

func (m TreeMap[K, V]) IsEmpty() bool

IsEmpty reports whether the map has no entries.

func (TreeMap[K, V]) Iter

func (m TreeMap[K, V]) Iter() iter.Seq2[K, V]

Iter iterates the entries in key order.

func (TreeMap[K, V]) IterFrom

func (m TreeMap[K, V]) IterFrom(from K) iter.Seq2[K, V]

IterFrom iterates the entries with keys from from onwards.

func (TreeMap[K, V]) Last

func (m TreeMap[K, V]) Last() (K, V, bool)

Last returns the entry with the greatest key.

func (*TreeMap[K, V]) Remove

func (m *TreeMap[K, V]) Remove(key K) (V, bool)

Remove deletes key and returns its value.

func (*TreeMap[K, V]) RemoveRange

func (m *TreeMap[K, V]) RemoveRange(start MapSeekTarget[K], end MapSeekTarget[K])

RemoveRange removes the entries from start up to end.

func (*TreeMap[K, V]) Retain

func (m *TreeMap[K, V]) Retain(predicate func(K, V) bool)

Retain keeps only the entries for which predicate returns true.

func (*TreeMap[K, V]) Update

func (m *TreeMap[K, V]) Update(key K, f func(*V)) bool

Update applies f to the value stored under key and reports whether it was present.

func (*TreeMap[K, V]) UpdateR

func (m *TreeMap[K, V]) UpdateR[R any](key K, f func(*V) R) (R, bool)

UpdateR applies f to the value stored under key and returns its result.

func (TreeMap[K, V]) Values

func (m TreeMap[K, V]) Values() iter.Seq[V]

Values iterates the values in key order.

type TreeSet

type TreeSet[K cmp.Ordered] struct {
	// contains filtered or unexported fields
}

TreeSet is an ordered set based on a TreeMap.

func TreeSetFromOrderedEntries

func TreeSetFromOrderedEntries[K cmp.Ordered](entries ...K) TreeSet[K]

TreeSetFromOrderedEntries builds a set from keys already in order.

func (TreeSet[K]) Contains

func (s TreeSet[K]) Contains(key K) bool

Contains reports whether key is present.

func (*TreeSet[K]) Extend

func (s *TreeSet[K]) Extend(keys ...K)

Extend adds every key.

func (*TreeSet[K]) Insert

func (s *TreeSet[K]) Insert(key K)

Insert adds key.

func (TreeSet[K]) IsEmpty

func (s TreeSet[K]) IsEmpty() bool

IsEmpty reports whether the set has no keys.

func (TreeSet[K]) Iter

func (s TreeSet[K]) Iter() iter.Seq[K]

Iter iterates the keys in order.

func (TreeSet[K]) IterFrom

func (s TreeSet[K]) IterFrom(key K) iter.Seq[K]

IterFrom iterates the keys from key onwards.

func (*TreeSet[K]) Remove

func (s *TreeSet[K]) Remove(key K) bool

Remove deletes key and reports whether it was present.

type Unit

type Unit[S any, C any] struct{}

Unit is the empty dimension, upstream's `()`.

func (Unit[S, C]) AddSummary

func (Unit[S, C]) AddSummary(S, C) Unit[S, C]

AddSummary returns Unit.

func (Unit[S, C]) Zero

func (Unit[S, C]) Zero(C) Unit[S, C]

Zero returns Unit.

Jump to

Keyboard shortcuts

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