forall T, E.
exposed enum Result {
Ok(T),
Err(E),
}
A successful Ok(T) value or a failed Err(E) value. Its multiplicity follows its payloads.
Methods
method mapsource
forall U, Env where Copy[Env].
fn map(self, f: closure[Env](T) -> U) -> Result[U, E] { ... }
f of the value, keeping an error as it is.
method map_errsource
forall F, Env where Copy[Env].
fn map_err(self, f: closure[Env](E) -> F) -> Result[T, F] { ... }
f of the error, keeping a value as it is.
method and_thensource
forall U, Env where Copy[Env].
fn and_then(self, f: closure[Env](T) -> Result[U, E]) -> Result[U, E] { ... }
f of the value, which may itself fail.
method is_oksource
fn is_ok(self) -> bool { ... }
Whether this is a value. A linear value or error is asked with match &r instead.
method is_errsource
fn is_err(self) -> bool { ... }
Whether this is an error.
method unwrap_orsource
fn unwrap_or(self, fallback: T) -> T { ... }
The value, or fallback on an error. Copy: one of the two is dropped.
method unwrap_or_elsesource
forall Env where Copy[Env].
fn unwrap_or_else(self, f: closure[Env](E) -> T) -> T { ... }
The value, or f of the error.
method errsource
fn err(self) -> Option[E] { ... }
The error as an Option. Copy[T]: a value is dropped.
method oksource
fn ok(self) -> Option[T] { ... }
The value as an Option. Copy[E]: an error is dropped.
method unwrapsource
fn unwrap(self) -> T { ... }
The value; stops the program (core::process::trap) on an error, which is dropped (Copy[E]). For an error that is a bug.