Documentation
¶
Index ¶
- type Option
- func (o Option[T]) AndThen(fn func(T) bool) bool
- func (o Option[T]) IsNone() bool
- func (o Option[T]) IsSome() bool
- func (o Option[T]) Split() (T, bool)
- func (o Option[T]) Then(fn func(T))
- func (o Option[T]) ThenPtr(fn func(*T))
- func (o Option[T]) Unwrap() T
- func (o Option[T]) UnwrapOr(t T) T
- func (o Option[T]) UnwrapOrElse(fn func() T) T
- func (o Option[T]) UnwrapPtr() *T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option[T any] struct { // contains filtered or unexported fields }
func (Option[T]) IsNone ¶
Returns true if the Option does not contain a value, false otherwise.
Inverse of IsSome
func (Option[T]) IsSome ¶
Returns true if the Option contains a value, false otherwise.
Inverse of IsNone
func (Option[T]) Unwrap ¶
func (o Option[T]) Unwrap() T
This function returns a copy of the data and not a pointer to it. Panics if the Option is None.
Modifying the result will not modify the original data instead use UnwrapPtr or Map
func (Option[T]) UnwrapOrElse ¶
func (o Option[T]) UnwrapOrElse(fn func() T) T
Click to show internal directories.
Click to hide internal directories.