result

package
v0.0.0-...-8bebe15 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0, MIT Imports: 0 Imported by: 0

Documentation

Overview

Package result provides a typed sum value representing either a successful outcome (Ok branch) or a failure (Err branch). It's used as the return type of github.com/fil-forge/ucantone/ucan.Receipt.Out.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result[O, X any] struct {
	// contains filtered or unexported fields
}

Result is a typed sum: either an Ok value of type O or an Err value of type X. Construct with OK or Err; inspect with Result.IsOK or unpack into a Go (ok, err) pair with Result.Unpack.

Both branches are zero-valued when the other branch is set; use IsOK to disambiguate before reading the populated branch.

func Err

func Err[O, X any](v X) Result[O, X]

Err constructs a failed Result holding the given value.

func OK

func OK[O, X any](v O) Result[O, X]

OK constructs a successful Result holding the given value.

func (Result[O, X]) IsErr

func (r Result[O, X]) IsErr() bool

IsErr reports whether the Err branch is populated.

func (Result[O, X]) IsOK

func (r Result[O, X]) IsOK() bool

IsOK reports whether the Ok branch is populated.

func (Result[O, X]) Unpack

func (r Result[O, X]) Unpack() (O, X)

Unpack returns the (ok, err) pair. The branch corresponding to !IsOK holds the zero value of its type.

Directories

Path Synopsis
gen command

Jump to

Keyboard shortcuts

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