Documentation
¶
Index ¶
- func Cast[TSource, TTarget any](source types.Option[TSource]) types.Result[types.Option[TTarget]]
- func Map[T, U any](op types.Option[T], transform func(t T) U) types.Option[U]
- func MapOr[T, U any](op types.Option[T], transform func(t T) U, def U) U
- func MapOrElse[T, U any](op types.Option[T], transform func(t T) U, def func() U) U
- func New[T any](t T, ok bool) types.Option[T]
- func None[T any]() types.Option[T]
- func Some[T any](value T) types.Option[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cast ¶
func Cast[TSource, TTarget any](source types.Option[TSource]) types.Result[types.Option[TTarget]]
Cast attempts to cast a source option type of TSource to a result option type of TTarget if the cast fails, Error is returned if the cast succeeds, Ok is returned wrapping the Option[TTarget]
func Map ¶ added in v0.5.2
func Map[T, U any](op types.Option[T], transform func(t T) U) types.Option[U]
Map returns none if op is none applies the function to the value if some and returns some of the result
func MapOr ¶ added in v0.5.2
func MapOr[T, U any](op types.Option[T], transform func(t T) U, def U) U
MapOr returns the default value if none. or applies the function to the value if some
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.