result

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToTuple

func ToTuple[T any](result Result[T]) (T, error)

Types

type Result

type Result[T any] struct {
	// contains filtered or unexported fields
}

func Err

func Err[T any](value error) Result[T]

func Ok

func Ok[T any](value T) Result[T]

func ToResult

func ToResult[T any](value T, err error) Result[T]

func (Result[T]) AssertErr

func (result Result[T]) AssertErr()

func (Result[T]) AssertOk

func (result Result[T]) AssertOk()

func (Result[T]) IsErr

func (result Result[T]) IsErr() bool

func (Result[T]) IsOk

func (result Result[T]) IsOk() bool

func (Result[T]) Match

func (result Result[T]) Match(okHandler func(T), errHandler func(error))

func (Result[T]) MustGetErr

func (result Result[T]) MustGetErr() error

func (Result[T]) MustGetOk

func (result Result[T]) MustGetOk() T

func (Result[T]) ToEither

func (result Result[T]) ToEither() choice.Choice[T, error]

func (Result[T]) Try

func (result Result[T]) Try(f func() (T, error)) Result[T]

func (Result[T]) TryT

func (result Result[T]) TryT(f func() (T, error)) Result[T]

Jump to

Keyboard shortcuts

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