Abstract
Represents a result that can either be a success (Ok<T>) or an error (Err<E>). Provides functional methods for safe computations without exceptions.
Ok<T>
Err<E>
The type of the successful value.
The type of the error.
Maps the successful value to another Result<U, E>, allowing chaining.
Result<U, E>
The transformed success type.
The function returning a Result<U, E>.
A new Result<U, E>.
Folds the result into a single value by applying one of two functions.
The return type.
Function applied to Err<E>.
Function applied to Ok<T>.
The computed value.
Determines if the result is Err<E>.
true if this is Err<E>, otherwise false.
true
false
Determines if the result is Ok<T>.
true if this is Ok<T>, otherwise false.
Maps the successful value using the given function.
The function to apply.
Maps the error using the given function.
The transformed error type.
A new Result<T, F>.
Result<T, F>
Returns an alternative Result<T, E> if this is Err<E>.
Result<T, E>
The alternative Result<T, E>.
The original Result<T, E> if Ok<T>, otherwise alternative.
alternative
Retrieves the success value if Ok<T>, otherwise returns a default.
The default value if Err<E>.
The contained value or defaultValue.
defaultValue
Retrieves the success value if Ok<T>, otherwise throws an error.
The contained value if Ok<T>.
Throws an error if Err<E>.
Static
Creates an error (Err<E>) result.
The error to wrap.
An Err instance containing the error.
Err
Creates a success (Ok<T>) result.
The value to wrap.
An Ok instance containing the value.
Ok
Represents a result that can either be a success (
Ok<T>
) or an error (Err<E>
). Provides functional methods for safe computations without exceptions.