Movatterモバイル変換


[0]ホーム

URL:


set

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:10Imported by:37

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package set contains set types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeHandle

type Handle struct {// contains filtered or unexported fields}

Handle is an opaque comparable value that's used as the map key in aHandleSet.

funcNewHandleadded inv1.90.0

func NewHandle()Handle

NewHandle returns a new handle value.

typeHandleSet

type HandleSet[Tany] map[Handle]T

HandleSet is a set of T.

It is not safe for concurrent use.

func (*HandleSet[T])Add

func (s *HandleSet[T]) Add(e T)Handle

Add adds the element (map value) e to the set.

It returns a new handle (map key) with which e can be removed, using a mapdelete or theHandleSet.Delete method.

func (HandleSet[T])Deleteadded inv1.90.0

func (sHandleSet[T]) Delete(hHandle)

Delete removes the element with handle h from the set.

typeIntSetadded inv1.86.0

type IntSet[Tconstraints.Integer] struct {// contains filtered or unexported fields}

IntSet is a set optimized for integer values close to zeroor set of integers that are close in value.

funcIntsOfadded inv1.88.0

func IntsOf[Tconstraints.Integer](slice ...T)IntSet[T]

IntsOf constructs anIntSet with the provided elements.

func (*IntSet[T])Addadded inv1.86.0

func (s *IntSet[T]) Add(e T)

Add adds e to the set.

When storing a IntSet in a map as a value type,it is important to re-assign the map entry after calling Add or Delete,as the IntSet's representation may change.

func (*IntSet[T])AddSeqadded inv1.86.0

func (s *IntSet[T]) AddSeq(seqiter.Seq[T])

AddSeq adds the values from seq to the set.

func (IntSet[T])Cloneadded inv1.86.0

func (sIntSet[T]) Clone()IntSet[T]

Clone returns a copy of s that doesn't alias the original.

func (IntSet[T])Containsadded inv1.86.0

func (sIntSet[T]) Contains(e T)bool

Contains reports whether e is in the set.

func (*IntSet[T])Deleteadded inv1.86.0

func (s *IntSet[T]) Delete(e T)

Delete removes e from the set.

When storing a IntSet in a map as a value type,it is important to re-assign the map entry after calling Add or Delete,as the IntSet's representation may change.

func (*IntSet[T])DeleteSeqadded inv1.88.0

func (s *IntSet[T]) DeleteSeq(seqiter.Seq[T])

DeleteSeq deletes the values in seq from the set.

func (IntSet[T])Equaladded inv1.88.0

func (sIntSet[T]) Equal(otherIntSet[T])bool

Equal reports whether s is equal to other.

func (IntSet[T])Lenadded inv1.86.0

func (sIntSet[T]) Len()int

Len reports the number of elements in the set.

func (IntSet[T])Valuesadded inv1.86.0

func (sIntSet[T]) Values()iter.Seq[T]

Values returns an iterator over the elements of the set.The iterator will yield the elements in no particular order.

typeSetadded inv1.42.0

type Set[Tcomparable] map[T]struct{}

Set is a set of T.

funcOfadded inv1.66.0

func Of[Tcomparable](slice ...T)Set[T]

Of returns a new set constructed from the elements in slice.

funcSetOfadded inv1.52.0

func SetOf[Tcomparable](slice []T)Set[T]

SetOf returns a new set constructed from the elements in slice.

func (Set[T])Addadded inv1.42.0

func (sSet[T]) Add(e T)

Add adds e to s.

func (Set[T])AddSetadded inv1.54.0

func (sSet[T]) AddSet(esSet[T])

AddSet adds each element of es to s.

func (Set[T])AddSliceadded inv1.52.0

func (sSet[T]) AddSlice(es []T)

AddSlice adds each element of es to s.

func (Set[T])Cloneadded inv1.54.0

func (sSet[T]) Clone()Set[T]

Clone returns a new set cloned from the elements in s.

func (Set[T])Containsadded inv1.42.0

func (sSet[T]) Contains(e T)bool

Contains reports whether s contains e.

func (Set[T])Deleteadded inv1.50.0

func (sSet[T]) Delete(e T)

Delete removes e from the set.

func (Set[T])Equaladded inv1.54.0

func (sSet[T]) Equal(otherSet[T])bool

Equal reports whether s is equal to other.

func (Set[T])Lenadded inv1.42.0

func (sSet[T]) Len()int

Len reports the number of items in s.

func (*Set[T])Makeadded inv1.66.0

func (s *Set[T]) Make()

Make lazily initializes the map pointed to by s to be non-nil.

func (Set[T])MarshalJSONadded inv1.56.0

func (sSet[T]) MarshalJSON() ([]byte,error)

func (Set[T])Sliceadded inv1.52.0

func (sSet[T]) Slice() []T

Slice returns the elements of the set as a slice. The elements will not bein any particular order.

func (*Set[T])UnmarshalJSONadded inv1.56.0

func (s *Set[T]) UnmarshalJSON(buf []byte)error

typeSliceadded inv1.40.0

type Slice[Tcomparable] struct {// contains filtered or unexported fields}

Slice is a set of elements tracked in a slice of unique elements.

func (*Slice[T])Addadded inv1.40.0

func (ss *Slice[T]) Add(vs ...T)

Add adds each element in vs to the set.The amortized cost is O(1) per element.

func (*Slice[T])AddSliceadded inv1.40.0

func (ss *Slice[T]) AddSlice(vsviews.Slice[T])

AddSlice adds all elements in vs to the set.

func (*Slice[T])Containsadded inv1.40.0

func (ss *Slice[T]) Contains(v T)bool

Contains reports whether v is in the set.The amortized cost is O(1).

func (*Slice[T])Lenadded inv1.50.0

func (ss *Slice[T]) Len()int

Len returns the number of elements in the set.

func (*Slice[T])Removeadded inv1.40.0

func (ss *Slice[T]) Remove(v T)

Remove removes v from the set.The cost is O(n).

func (*Slice[T])Sliceadded inv1.40.0

func (ss *Slice[T]) Slice()views.Slice[T]

Slice returns a view of the underlying slice.The elements are in order of insertion.The returned value is only valid until ss is modified again.

typeSmallSetadded inv1.86.0

type SmallSet[Tcomparable] struct {// contains filtered or unexported fields}

SmallSet is a set that is optimized for reducing memory overhead when theexpected size of the set is 0 or 1 elements.

The zero value of SmallSet is a usable empty set.

When storing a SmallSet in a map as a value type, it is important to re-assignthe map entry after calling Add or Delete, as the SmallSet's representationmay change.

Copying a SmallSet by value may alias the previous value. Use the Clone methodto create a new SmallSet with the same contents.

func (*SmallSet[T])Addadded inv1.86.0

func (s *SmallSet[T]) Add(e T)

Add adds e to the set.

When storing a SmallSet in a map as a value type, it is important tore-assign the map entry after calling Add or Delete, as the SmallSet'srepresentation may change.

func (SmallSet[T])Cloneadded inv1.86.0

func (sSmallSet[T]) Clone()SmallSet[T]

Clone returns a copy of s that doesn't alias the original.

func (SmallSet[T])Containsadded inv1.86.0

func (sSmallSet[T]) Contains(e T)bool

Contains reports whether e is in the set.

func (*SmallSet[T])Deleteadded inv1.86.0

func (s *SmallSet[T]) Delete(e T)

Delete removes e from the set.

When storing a SmallSet in a map as a value type, it is important tore-assign the map entry after calling Add or Delete, as the SmallSet'srepresentation may change.

func (SmallSet[T])Lenadded inv1.86.0

func (sSmallSet[T]) Len()int

Len reports the number of elements in the set.

func (SmallSet[T])SoleElementadded inv1.86.0

func (sSmallSet[T]) SoleElement() (e T, okbool)

SoleElement returns the single value in the set, if the set has exactly oneelement.

If the set is empty or has more than one element, ok will be false and e willbe the zero value of T.

func (SmallSet[T])Valuesadded inv1.86.0

func (sSmallSet[T]) Values()iter.Seq[T]

Values returns an iterator over the elements of the set.The iterator will yield the elements in no particular order.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp