pub trait ResConv<T, E> {
// Required methods
fn into_option(self) -> Option<T>;
fn into_result(self) -> Result<T, E>;
}Expand description
Conversions between Result and Option with optional value transformation.
Required Methods§
Sourcefn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts into Option<T>, dropping any error information.
Sourcefn into_result(self) -> Result<T, E>
fn into_result(self) -> Result<T, E>
Converts into Result<T, E>.
§Errors
Returns Err(E) when the source value represents an absent or failed state.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<Input, Output, Err: Default> ResConv<Output, Err> for Option<Input>where
Input: Into<Output>,
impl<Input, Output, Err: Default> ResConv<Output, Err> for Option<Input>where
Input: Into<Output>,
Source§fn into_result(self) -> Result<Output, Err>
fn into_result(self) -> Result<Output, Err>
- Transforms
Some(T)intoOk(T). - Transforms
NoneintoErr(Err::Default())
§Errors
- Returns
Err(Err::Default())ifselfisNone.