Documentation
¶
Index ¶
- type Bool
- type Enum
- type Enumer
- type Int
- type Set
- func (s *Set[T]) Add(elem T) bool
- func (s *Set[T]) Clean()
- func (s *Set[T]) DeepCopy() pkg.Type
- func (s Set[T]) Each() iter.Seq[T]
- func (s *Set[T]) Ensure()
- func (s *Set[T]) Equals(other pkg.Type) bool
- func (s Set[T]) Has(elem T) bool
- func (s Set[T]) IsEmpty() bool
- func (s *Set[T]) Reset()
- func (s Set[T]) Size() int
- func (s *Set[T]) String() string
- func (s *Set[T]) Union(other *Set[T]) int
- func (s *Set[T]) WithValue(slice []T) *Set[T]
- type Wrap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool is a bool.
func NewBool ¶
func NewBool() *Bool
NewBool creates a new bool initialized to false.
Returns:
- *Bool: The new bool. Never returns nil.
func (*Bool) Each ¶
Each creates an iterator that iterates over the bool.
Returns:
- iter.Seq[*Bool]: The iterator. Never returns nil.
The iterator always returns until a break, return statement is reached, or the value given by the iterator is set to false.
func (*Bool) Equals ¶
Equals implements the pkg.Type interface.
Two bools are equal if they have the same value and are both bools.
type Enum ¶
type Enum[T Enumer] struct { // contains filtered or unexported fields }
Enum is an enum.
func NewEnum ¶
NewEnum creates a new enum.
Parameters:
- value: The value.
Returns:
- *Enum: The new enum. Never returns nil.
func (*Enum[T]) Equals ¶
Equals implements the pkg.Type interface.
Two enums are equal if they have the same value and are both enums.
func (*Enum[T]) Set ¶
func (e *Enum[T]) Set(value T)
Set sets the enum value.
Parameters:
- value: The new value.
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int is an index.
func NewInt ¶
func NewInt() *Int
NewIndex creates a new index.
Returns:
- *Int: The new index. Never returns nil.
func (*Int) Equals ¶
Equals implements the pkg.Type interface.
Two indexes are equal if they have the same value; regardless of the max value.
type Set ¶
Set is a set.
func (*Set[T]) Add ¶
Add adds an element to the set. If the element is already in the set, this method does nothing.
Parameters:
- elem: The element to add.
Returns:
- bool: True if the element was added, false otherwise.
func (Set[T]) Each ¶
Each returns an iterator that iterates over all elements in the set.
Returns:
- iter.Seq[T]: The iterator. Never returns nil.
func (*Set[T]) Equals ¶
Equals implements the pkg.Type interface.
Two sets are equal if they have the same values.
func (Set[T]) Has ¶
Has checks whether the set contains the given element.
Parameters:
- elem: The element to check.
Returns:
- bool: True if the set contains the element, false otherwise.
func (Set[T]) IsEmpty ¶
IsEmpty checks whether the set is empty.
Returns:
- bool: True if the set is empty, false otherwise.
func (Set[T]) Size ¶
Size returns the number of elements in the set.
Returns:
- int: The number of elements in the set.
type Wrap ¶
type Wrap[T comparable] struct { // contains filtered or unexported fields }
Wrap is a wrapper.
func NewWrap ¶
func NewWrap[T comparable](value T) *Wrap[T]
NewWrap creates a new wrap.
Parameters:
- value: The value to wrap.
Returns:
- *Wrap: The new wrap. Never returns nil.
func (*Wrap[T]) Equals ¶
Equals implements the pkg.Type interface.
Two wraps are equal if they have the same value adn are both wraps.
func (*Wrap[T]) Set ¶
func (w *Wrap[T]) Set(value T)
Set sets the wrapped value.
Parameters:
- value: The new value.