pub trait MapExpect<'a, T> {
// Required method
fn map_expect(self, msg: &'a str) -> T;
}Expand description
Applies an expectation to a nested optional or fallible value.
Implementations cover Option<Result<T, E>> and Result<Option<T>, E>.
Only the nested value is unwrapped, preserving the outer container.
Required Methods§
Sourcefn map_expect(self, msg: &'a str) -> T
fn map_expect(self, msg: &'a str) -> T
Unwraps the nested value with the supplied expectation message.
The outer Option or Result is preserved. The message is used only
when the nested value is absent or failed.
§Panics
Panics when the nested value does not contain a success value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".