Rustic.Result (Rustic.Result v0.1.0) View Source

Documentation for RusticResult.

Link to this section Summary

Types

Describe an Err value

f()

A function that maps a value to a result

Describe an Ok value

t()

Describe a Result type

Functions

Apply a function which returns a result to an Ok result, or propagates the error.

Wraps a value into an Err result

Wraps a value into an Ok result

Apply a function which returns a result to an Err result, or propagates the Ok value.

Unwrap an Ok result, or raise an Err result as an exception

Link to this section Types

Specs

err() :: {:error, term()}

Describe an Err value

Specs

f() :: (any() -> t())

A function that maps a value to a result

Specs

ok() :: {:ok, any()}

Describe an Ok value

Specs

t() :: ok() | err()

Describe a Result type

Link to this section Functions

Specs

and_then(t(), f()) :: t()

Apply a function which returns a result to an Ok result, or propagates the error.

Specs

err(term()) :: err()

Wraps a value into an Err result

Specs

ok(any()) :: ok()

Wraps a value into an Ok result

Specs

or_else(t(), f()) :: t()

Apply a function which returns a result to an Err result, or propagates the Ok value.

Specs

unwrap!(t()) :: any()

Unwrap an Ok result, or raise an Err result as an exception