A trait for customizing the behavior of the
A type implementing
Try is one that has a canonical way to view it
in terms of a success/failure dichotomy. This trait allows both
extracting those success or failure values from an existing instance and
creating a new instance from a success or failure value.
The type of this value when viewed as successful.
The type of this value when viewed as failed.
#[lang = "into_result"]fn into_result(self) -> Result<Self::Ok, Self::Error>
Applies the "?" operator. A return of
Ok(t) means that the
execution should continue normally, and the result of
? is the
t. A return of
Err(e) means that execution should branch
to the innermost enclosing
catch, or return from the function.
Err(e) result is returned, the value
e will be "wrapped"
in the return type of the enclosing scope (which must itself implement
Try). Specifically, the value
is returned, where
X is the return type of the enclosing function.
#[lang = "from_error"]fn from_error(v: Self::Error) -> Self
Wrap an error value to construct the composite result. For example,
Result::from_error(x) are equivalent.
Wrap an OK value to construct the composite result. For example,
Result::from_ok(x) are equivalent.