option

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

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 Fmap

func Fmap[T any, R any](opt Option[T], f func(x T) R) Option[R]

func None

func None[T any]() Option[T]

func Some

func Some[T any](x T) Option[T]

func (Option[T]) IsSome

func (opt Option[T]) IsSome() bool

func (*Option[T]) Replace

func (opt *Option[T]) Replace(x T)

func (Option[T]) ToString

func (opt Option[T]) ToString() string

func (Option[T]) Unwrap

func (opt Option[T]) Unwrap() T

func (Option[T]) UnwrapOr added in v0.0.10

func (opt Option[T]) UnwrapOr(defa T) T

UnwrapOr returns the wrapped value or the default value <defa>

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL