README ¶ go-option A Rust-like error handler for Go Expand ▾ Collapse ▴ Documentation ¶ Index ¶ type Optional func Err[T any](err_ error) *Optional[T] func None[T any]() *Optional[T] func Some[T any](value T) *Optional[T] func SomePair[T any](value T, err error) *Optional[T] func (o *Optional[T]) Error() string func (o *Optional[T]) Expect(err string) T func (o *Optional[T]) ExpectNil(err string) func (o *Optional[T]) IsNil() bool func (o *Optional[T]) Or(value T) T func (o *Optional[T]) Unwrap() T func (o *Optional[T]) UnwrapOrElse(errFn func(err error) T) T Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Optional ¶ type Optional[T any] struct { // contains filtered or unexported fields } func Err ¶ func Err[T any](err_ error) *Optional[T] func None ¶ func None[T any]() *Optional[T] func Some ¶ func Some[T any](value T) *Optional[T] func SomePair ¶ func SomePair[T any](value T, err error) *Optional[T] func (*Optional[T]) Error ¶ func (o *Optional[T]) Error() string func (*Optional[T]) Expect ¶ func (o *Optional[T]) Expect(err string) T func (*Optional[T]) ExpectNil ¶ func (o *Optional[T]) ExpectNil(err string) func (*Optional[T]) IsNil ¶ func (o *Optional[T]) IsNil() bool func (*Optional[T]) Or ¶ func (o *Optional[T]) Or(value T) T func (*Optional[T]) Unwrap ¶ func (o *Optional[T]) Unwrap() T func (*Optional[T]) UnwrapOrElse ¶ func (o *Optional[T]) UnwrapOrElse(errFn func(err error) T) T Source Files ¶ View all Source files option.go Click to show internal directories. Click to hide internal directories.