Success (Ok) payload type.
Enables yield* res inside a result.gen body — the equivalent of Rust's
? operator.
On Ok, yield* produces no yields and evaluates to the contained value.
On Err, it yields the Err itself, which the surrounding
result.gen / genSync / genAsync driver returns by reference
(short-circuiting the rest of the body). Not meant to be iterated by
anything other than those drivers.
Returns res if this result is Ok, otherwise returns this Err.
res is evaluated eagerly; prefer andThen when it comes from a function
call that should run only after Ok.
res on Ok, or this on Err.
Calls fn if this result is Ok, otherwise returns this Err.
Use to chain fallible steps that return another Result.
The Result from fn, or this on Err.
Returns the contained Ok value.
Prefer narrowing (isOk / isErr) or non-throwing helpers (unwrapOr,
unwrapOrElse) when the Err case is expected.
Included in the thrown Error when this result is Err
(describe why you expected Ok, as in Rust's expect docs).
The success value.
Calls fn with the contained Ok value, then returns this unchanged.
Callbacks receive DeepReadonly views (compile-time only; no runtime freeze).
this (for chaining).
Calls fn with the contained Err value, then returns this unchanged.
Side effect for the error value; not called on Ok.
this (for chaining).
Maps a Result to U by applying onErr to a contained Err value, or onOk
to a contained Ok value.
Returns the contained Ok value.
The success value.
Returns the contained Ok value, or computes it from the Err value.
T on Ok, otherwise the value returned by fn.
Method contract shared by Ok and Err, aligned with Rust
std::result::Result.Result<T, E>is either success (Ok(T)) or failure (Err(E)). Implementations mirror the Rust combinator names and semantics; on failure,expect/unwrap/unwrapErrthrow a JavaScriptErrorinstead of panicking.See
https://doc.rust-lang.org/std/result/enum.Result.html