the type of successful results
the type of error results
Takes a function which takes the value contained in this and returns a
new Result; calls it and returns the result if this is Ok,
otherwise returns this. Also sometimes known in other languages or
libraries as flatmap or bind.
the type contained in the Result returned by fn
the result of calling fn if this is Ok, this otherwise
Takes a function which takes the value contained in this and returns a
promise which resolves to a new Result; calls it and returns the
result if this is Ok, otherwise returns a promise which resolves to
this. This is an async version of andThen.
the type contained in the Result returned by fn
the result of calling fn if this is Ok, this otherwise
Takes a function which takes an error and returns a promise which resolves
to a new Result; calls it with the contained error and returns the
result if this is Err, otherwise returns a promise which resolves to
this.
the result of calling fn if this is Err, this otherwise
StaticErrStaticOkStaticwrapTakes a function that could be throw and converts it into an Result.
the type contained by the Result
the function which could throw
Ok with the return value of fn if fn doesn't throw,
otherwise Err containing an Option which is None if the
exception is null or undefined, and is Some with the exception
otherwise
StaticwrapTakes a promise that could reject and converts it into an Result.
the type contained by the Result
the promise to convert
a Promise containing Ok with the value resolved by promise if
promise doesn't reject, otherwise Err containing an Option
which is None if promise rejects with a null or undefined, and is
Some with the rejection value otherwise
Takes two functions, one is called with the contained value if this is
Ok and the other is called with the error if this is Err.
the type of the return value of the matcher functions
the return value of the Ok or Err matcher function
Returns the contained value if this is Ok, otherwise call the provided
function with the error value and return the result.
the contained if this is Ok, otherwise the return value from
calling defaultValue on the error value
If this is Err, returns Option.Some containing the value in
this. Otherwise return Option.None.
Option.Some with the value in this if this is Err,
Option.None otherwise
If this is Ok, returns Option.Some containing the value in
this. Otherwise return Option.None.
Option.Some with the value in this if this is Ok,
Option.None otherwise
the type of the value contained in the Option
contained in this
if this is Err, returns Option.Some containing this;
if this is Ok and the Option in this is Option.None,
returns Option.None; otherwise returns Option.Some
containing Ok containing the value in the Option in this
Transforms Result<T, E> to Result<U, E> by applying the provided
function to the contained value of Ok and leaving Err values unchanged.
the type of the return value of fn
this if this is Err, otherwise Ok containing the result of
applying fn to the value in this
Transforms Result<T, E> to Promise<Result<U, E>> by applying the
provided async function to the contained value of Ok and resolving Err
values unchanged.
the type of the value in the promise returned by fn
a promise resolving to this if this is Err, otherwise a
promise resolving to Ok containing the value resolved by the promise
returned from applying fn to the value in this
Transforms Result<T, E> to Result<T, F> by applying the provided
function to the contained value of Err and leaving Ok values unchanged.
the type of the return value of fn
this if this is Ok, otherwise Err containing the result of
applying fn to the value in this
Transforms Result<T, E> to Promise<Result<T, F>> by applying the
provided async function to the contained value of Err and resolving Ok
values unchanged.
the type of the value in the promise returned by fn
a promise resolving to this if this is Ok, otherwise a
promise resolving to Err containing the value resolved by the promise
returned from applying fn to the value in this
Applies the provided function to the contained value if this is Ok,
otherwise returns the provided default value.
the type of defaultValue and the value returned by fn
the result of applying fn to the value in this if this is
Ok, otherwise defaultValue
StaticcollectTakes an Array of Result values. If any of the Result
values in the array is Err, returns that Err. Otherwise, returns Ok
containing an Array of each value inside each Result in the
original list.
Ok containing an Array of values contained by each Result in the original Array if all Result values in the original
list are Ok, otherwise returns the first Err in the Array
A type which represents values that may encode either a successful result or an error result.