Documentation
¶
Index ¶
- type Value
- func (o Value[T]) IsNone() bool
- func (o Value[T]) IsSome() bool
- func (o Value[T]) Or(other Value[T]) Value[T]
- func (o Value[T]) OrElse(value func() Value[T]) Value[T]
- func (o Value[T]) OrSome(value T) T
- func (o Value[T]) OrZero() T
- func (o *Value[T]) Replace(value T) Value[T]
- func (o *Value[T]) Reset()
- func (o *Value[T]) Take() Value[T]
- func (o Value[T]) Unwrap() (T, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Value ¶
type Value[T any] struct { // contains filtered or unexported fields }
Value is an optional Value containing a value of type T inside.
func (Value[T]) OrElse ¶
OrElse returns Some(value) if the inner value is present, otherwise it calls provided function and returns its result.
func (Value[T]) OrSome ¶
func (o Value[T]) OrSome(value T) T
OrSome returns the inner value T if present, otherwise it returns provided value.
func (Value[T]) OrZero ¶
func (o Value[T]) OrZero() T
OrZero returns the inner value T if present, otherwise it returns zero initialized value.
Click to show internal directories.
Click to hide internal directories.