Documentation
¶
Index ¶
- func And[T any, U any](o gust.Option[T], optb gust.Option[U]) gust.Option[U]
- func AndThen[T any, U any](o gust.Option[T], f func(T) gust.Option[U]) gust.Option[U]
- func Contains[T comparable](o gust.Option[T], x T) bool
- func FuzzyAssert[T any, U any](o gust.Option[T]) gust.Option[U]
- func Map[T any, U any](o gust.Option[T], f func(T) U) gust.Option[U]
- func MapOr[T any, U any](o gust.Option[T], defaultSome U, f func(T) U) U
- func MapOrElse[T any, U any](o gust.Option[T], defaultFn func() U, f func(T) U) U
- func SafeAssert[T any, U any](o gust.Option[T]) gust.Result[gust.Option[U]]
- func Unzip[T any, U any](p gust.Option[gust.Pair[T, U]]) gust.Pair[gust.Option[T], gust.Option[U]]
- func XFuzzyAssert[U any](o gust.Option[any]) gust.Option[U]
- func XSafeAssert[U any](o gust.Option[any]) gust.Result[gust.Option[U]]
- func Zip[A any, B any](a gust.Option[A], b gust.Option[B]) gust.Option[gust.Pair[A, B]]
- func ZipWith[T any, U any, R any](some gust.Option[T], other gust.Option[U], f func(T, U) R) gust.Option[R]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](o gust.Option[T], x T) bool
Contains returns `true` if the option is a [`Some`] value containing the given value.
func FuzzyAssert ¶ added in v1.6.0
FuzzyAssert asserts gust.Option[T] as gust.Option[U]. NOTE:
If the assertion fails, return none.
func Map ¶
Map maps an `gust.Option[T]` to `gust.Option[U]` by applying a function to a contained value.
func MapOr ¶
MapOr returns the provided default value (if none), or applies a function to the contained value (if any).
func MapOrElse ¶
MapOrElse computes a default function value (if none), or applies a different function to the contained value (if any).
func SafeAssert ¶ added in v1.6.0
SafeAssert asserts gust.Option[T] as gust.Result[gust.Option[U]]. NOTE:
If the assertion fails, return error.
func XFuzzyAssert ¶ added in v1.6.0
XFuzzyAssert asserts gust.Option[any] as gust.Option[U]. NOTE:
If the assertion fails, return none.
func XSafeAssert ¶ added in v1.6.0
XSafeAssert asserts gust.Option[any] as gust.Result[gust.Option[U]]. NOTE:
If the assertion fails, return error.
func Zip ¶ added in v0.7.0
Zip zips `a` with b `Option`.
If `a` is `gust.Some(s)` and `b` is `gust.Some(o)`, this method returns `gust.Some(gust.Pair{A:s, B:o})`. Otherwise, `None` is returned.
func ZipWith ¶
func ZipWith[T any, U any, R any](some gust.Option[T], other gust.Option[U], f func(T, U) R) gust.Option[R]
ZipWith zips `value` and another `gust.Option` with function `f`.
If `value` is `Some(s)` and `other` is `Some(o)`, this method returns `Some(f(s, o))`. Otherwise, `None` is returned.
Types ¶
This section is empty.