Skip to contents

Result classes

The S7 classes defined by this package

Result() stable
The abstract parent class of the Success and Failure classes
Success() stable
A class for representing the value of a successful computation
Failure() stable
A class for representing a failed or stopped computation

Option classes

The S7 classes implementing “optional” values

Option()
The abstract parent class of the Some and Nothing classes
Some()
An object to represent "some value".
Nothing()
A class to represent no-value or nothing.

Unwrapping values

Functions for unwrapping the values contained in Result or Option objects

inspect() stable
Apply a function to a Result's value if it is a success
inspect_fail() stable
Apply a function to a Result's error if it is a failure
expect() stable
Get the wrapped value from a Result or Option object
expect_fail() stable
Get the wrapped error details from a Failure object
unwrap() stable
Get the wrapped value from a Result or Option object
unwrap_fail() stable
Get the wrapped error details from a Failure object
unwrap_option() stable
Get the wrapped value from a Result, wrapped in an Option object
unwrap_fail_option() stable
Get the wrapped error from a Result, wrapped in an Option object
unwrap_or_default() stable
Get the wrapped value from a Result or Option object
unwrap_or_else() stable
Get the wrapped value from a Result or Option object

Function wrappers

Modify functions to return Result or Option classes.

result()
Wrap an existing function to return Result objects
wrap_in_result()
Wrap a value in a Result object depending on its class.

Control flow

Functions for

and_then() stable
Process a success or pass through a failure
or_else() stable
Process a failiure or pass through a success

Utilities

Misc helper functions

is_result() stable
Check if an object is a subclass of Result
check_is_result() stable
Check if an object is a subclass of Result
is_success() stable
Check if an object is a subclass of Success
is_success_and() stable
Check if an object is a subclass of Success AND a predicate is true
is_failure() stable
Check if an object is a subclass of Failure
is_failure_and() stable
Check if an object is a subclass of Failure AND a predicate is true