pub trait ExpectedResult<T>where
Self: Sized,{
// Required method
fn expect_result_nb<F>(self, msgf: F) -> Result<T, ExpectationFailed>
where F: FnOnce() -> String;
// Provided methods
fn expect_result_nb_(self, msg: &str) -> Result<T, ExpectationFailed> { ... }
fn expect_result_(self, msg: &str) -> Result<T, Box<dyn Error>> { ... }
fn expect_result<F>(self, msgf: F) -> Result<T, Box<dyn Error>>
where F: FnOnce() -> String { ... }
}👎Deprecated: This module is in maintenance mode; the
anyhow library might be a better choiceExpand description
Test the value and return a result object containing either the inner value or an error object that, when displayed, will provide the specified error message.
Required Methods§
Sourcefn expect_result_nb<F>(self, msgf: F) -> Result<T, ExpectationFailed>
👎Deprecated: This module is in maintenance mode; the anyhow library might be a better choice
fn expect_result_nb<F>(self, msgf: F) -> Result<T, ExpectationFailed>
anyhow library might be a better choiceReturn a result object with a non-boxed Error object.
Invoke the specified function to obtain the error message.
§Errors
ExpectationFailed on error.
Provided Methods§
Sourcefn expect_result_nb_(self, msg: &str) -> Result<T, ExpectationFailed>
👎Deprecated: This module is in maintenance mode; the anyhow library might be a better choice
fn expect_result_nb_(self, msg: &str) -> Result<T, ExpectationFailed>
anyhow library might be a better choiceSourcefn expect_result_(self, msg: &str) -> Result<T, Box<dyn Error>>
👎Deprecated: This module is in maintenance mode; the anyhow library might be a better choice
fn expect_result_(self, msg: &str) -> Result<T, Box<dyn Error>>
anyhow library might be a better choiceReturn a result object that may be tested using the ? operator.
§Errors
ExpectationFailed on error.
Sourcefn expect_result<F>(self, msgf: F) -> Result<T, Box<dyn Error>>
👎Deprecated: This module is in maintenance mode; the anyhow library might be a better choice
fn expect_result<F>(self, msgf: F) -> Result<T, Box<dyn Error>>
anyhow library might be a better choiceReturn a result object that may be tested using the ? operator.
Invoke the specified function to obtain the error message.
§Errors
ExpectationFailed on error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl ExpectedResult<()> for bool
impl ExpectedResult<()> for bool
Source§fn expect_result_nb<F>(self, msgf: F) -> Result<(), ExpectationFailed>
fn expect_result_nb<F>(self, msgf: F) -> Result<(), ExpectationFailed>
👎Deprecated: This module is in maintenance mode; the
anyhow library might be a better choiceSource§impl<T> ExpectedResult<T> for Option<T>
impl<T> ExpectedResult<T> for Option<T>
Source§fn expect_result_nb<F>(self, msgf: F) -> Result<T, ExpectationFailed>
fn expect_result_nb<F>(self, msgf: F) -> Result<T, ExpectationFailed>
👎Deprecated: This module is in maintenance mode; the
anyhow library might be a better choiceSource§impl<T, E> ExpectedResult<T> for Result<T, E>where
E: Display,
impl<T, E> ExpectedResult<T> for Result<T, E>where
E: Display,
Source§fn expect_result_nb<F>(self, msgf: F) -> Result<T, ExpectationFailed>
fn expect_result_nb<F>(self, msgf: F) -> Result<T, ExpectationFailed>
👎Deprecated: This module is in maintenance mode; the
anyhow library might be a better choice