Documentation ¶
Index ¶
- Variables
- func IterUnion[T comparable](sets []Set[T], f func(item T) bool)
- type Set
- type Typed
- func (set Typed[T]) Add(item T)
- func (set Typed[T]) AddAll(itemArray []T)
- func (set Typed[T]) AddSet(other Set[T])
- func (set Typed[T]) Clear()
- func (set Typed[T]) Contains(item T) bool
- func (set Typed[T]) ContainsAll(other Set[T]) bool
- func (set Typed[T]) Copy() Set[T]
- func (set Typed[T]) Discard(item T)
- func (set Typed[T]) Equals(other Set[T]) bool
- func (set Typed[T]) Iter(visitor func(item T) error)
- func (set Typed[T]) Len() int
- func (set Typed[T]) Slice() (s []T)
- func (set Typed[T]) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StopIteration = errors.New("stop iteration") RemoveItem = errors.New("remove item") )
Functions ¶
func IterUnion ¶
func IterUnion[T comparable](sets []Set[T], f func(item T) bool)
IterUnion iterates over the values in the union of the given sets. For small numbers of sets, it can avoid allocating an actual union set. Iteration continues while the passed in func returns true.
Types ¶
type Typed ¶
type Typed[T comparable] map[T]v
func Empty ¶
func Empty[T comparable]() Typed[T]
Empty returns a read-only set with no members. Calls to Add etc. panic.
func From ¶
func From[T comparable](members ...T) Typed[T]
func FromArray ¶
func FromArray[T comparable](membersArray []T) Typed[T]
func New ¶
func New[T comparable]() Typed[T]
func NewSize ¶
func NewSize[T comparable](size int) Typed[T]
func (Typed[T]) ContainsAll ¶
Click to show internal directories.
Click to hide internal directories.