Function fromResult

  • Construct a Maybe from a Result.Result Result<T, E>.

    If the Result is an Ok, wrap its value in Just. If the Result is an Err, throw away the wrapped E and transform to a Nothing.

    Type Parameters

    • T

    Parameters

    • result: Result<T, unknown>

      The Result to construct a Maybe from.

    Returns Maybe<T>

    Just if result was Ok or Nothing if it was Err.

    Typeparam

    T The type of the value wrapped in a Result.Ok and in the Just of the resulting Maybe.

Generated using TypeDoc