Documentation ¶
Overview ¶
This package holds the concrete implementation of several simple data structures that can be used from any package. This package imports no other packages, meaning this package can be imported everywhere.
Index ¶
- type Pair
- type Triple
- type Variant
- func (v Variant[A, B]) HasA() bool
- func (v Variant[A, B]) HasB() bool
- func (v Variant[A, B]) SetValA(newVal A) Variant[A, B]
- func (v Variant[A, B]) SetValB(newVal B) Variant[A, B]
- func (v Variant[A, B]) ValA() A
- func (v Variant[A, B]) ValAOr(_default A) A
- func (v Variant[A, B]) ValB() B
- func (v Variant[A, B]) ValBOr(_default B) B
- type WidgetPair
- type WidgetTriple
- func (_ *WidgetTriple[T, U, V, TI, UI, VI]) Eq(l *WidgetTriple[T, U, V, TI, UI, VI], r *WidgetTriple[T, U, V, TI, UI, VI]) bool
- func (_ *WidgetTriple[T, U, V, TI, UI, VI]) Hash(other *WidgetTriple[T, U, V, TI, UI, VI]) hash.Hash
- func (_ *WidgetTriple[T, U, V, TI, UI, VI]) Zero(other *WidgetTriple[T, U, V, TI, UI, VI])
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Variant ¶
A variant type that can hold one of two types at a single time. The underlying value can be accessed through methods of the variant. Trying to access the wrong value will result in a panic unless a default value is supplied. The size of the struct will be equal to the largest type plus one byte which is used to specify which value is in the variant.
func NewVariant ¶
func (Variant[A, B]) SetValA ¶
Sets the variant to hold value type A, initilized with the value passed to the function. After calling this method the variant will panic if value type B is attempted to be accessed.
func (Variant[A, B]) SetValB ¶
Sets the variant to hold value type B, initilized with the value passed to the function. After calling this method the variant will panic if value type A is attempted to be accessed.
func (Variant[A, B]) ValA ¶
func (v Variant[A, B]) ValA() A
Attempts to return value A from the variant. Panics if the variant does not hold type A.
func (Variant[A, B]) ValAOr ¶
func (v Variant[A, B]) ValAOr(_default A) A
Attempts to return value A from the variant. If the variant does not hold type A then it will return the default value.
type WidgetPair ¶
type WidgetPair[ T any, U any, TI widgets.BaseInterface[T], UI widgets.BaseInterface[U], ] Pair[T, U]
func (*WidgetPair[T, U, TI, UI]) Eq ¶
func (_ *WidgetPair[T, U, TI, UI]) Eq( l *WidgetPair[T, U, TI, UI], r *WidgetPair[T, U, TI, UI], ) bool
type WidgetTriple ¶
type WidgetTriple[ T any, U any, V any, TI widgets.BaseInterface[T], UI widgets.BaseInterface[U], VI widgets.BaseInterface[V], ] Triple[T, U, V]
func (*WidgetTriple[T, U, V, TI, UI, VI]) Eq ¶
func (_ *WidgetTriple[T, U, V, TI, UI, VI]) Eq( l *WidgetTriple[T, U, V, TI, UI, VI], r *WidgetTriple[T, U, V, TI, UI, VI], ) bool