result

package
v1.20.3-rpc-p01-hf02 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0, MIT Imports: 0 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result[T any] struct {
	Value T
	Error error
}

Result is a small wrapper type encapsulating Value/Error tuples, mostly for use when sending values across channels NOTE: Avoid adding any functionality to this, any "nice" things added here will make it more difficult to switch to a more standardised Result-like type when one gets into the stdlib, or when we will want to switch to a library providing those types.

func Err

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

func Ok

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

func Wrap

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

func (Result[T]) Assert added in v1.20.0

func (r Result[T]) Assert(noErrFn func(err error, msgAndArgs ...interface{})) T

func (Result[T]) Unwrap

func (r Result[T]) Unwrap() (T, error)

Jump to

Keyboard shortcuts

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