result

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyResult added in v0.0.2

type AnyResult interface {
	Any() Result[any] // The Any method returns a Result[any] that can be used with any type.
}

AnyResult can be used with any Result.

type Result

type Result[R any] interface {
	AnyResult
	V() (R, error) // The V method returns the final value or an error.
	Value() R      // The Value method returns the final value.
	Err() error    // The Err method returns the error.
}

Result defines the interface for returning results from asynchronous operations. It encapsulates the final value or error from the operation.

func Of

func Of[R any](value R, err error) Result[R]

Of creates a new Result from a pair of values.

func OfError

func OfError[R any](err error) Result[R]

OfError creates a new Result from an error.

func OfValue

func OfValue[R any](value R) Result[R]

OfValue creates a new Result from a value.

Jump to

Keyboard shortcuts

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