pub trait IntoError<T>: Sealedwhere
Self: Sized,{
// Required method
fn ok_or_error<C, F>(self, kind: ErrorKind, f: F) -> Result<T, Error>
where C: ToString,
F: FnOnce() -> C;
// Provided methods
fn ok_or_invalid_data<C, F>(self, f: F) -> Result<T, Error>
where C: ToString,
F: FnOnce() -> C { ... }
fn ok_or_invalid_input<C, F>(self, f: F) -> Result<T, Error>
where C: ToString,
F: FnOnce() -> C { ... }
fn ok_or_not_found<C, F>(self, f: F) -> Result<T, Error>
where C: ToString,
F: FnOnce() -> C { ... }
fn ok_or_unexpected_eof<C, F>(self, f: F) -> Result<T, Error>
where C: ToString,
F: FnOnce() -> C { ... }
}Expand description
A trait providing conversion shortcuts for creating Error
instances.
Required Methods§
Provided Methods§
Sourcefn ok_or_invalid_data<C, F>(self, f: F) -> Result<T, Error>
fn ok_or_invalid_data<C, F>(self, f: F) -> Result<T, Error>
Unwrap self into an Ok or an Error of the
ErrorKind::InvalidData kind.
Sourcefn ok_or_invalid_input<C, F>(self, f: F) -> Result<T, Error>
fn ok_or_invalid_input<C, F>(self, f: F) -> Result<T, Error>
Unwrap self into an Ok or an Error of the
ErrorKind::InvalidInput kind.
Sourcefn ok_or_not_found<C, F>(self, f: F) -> Result<T, Error>
fn ok_or_not_found<C, F>(self, f: F) -> Result<T, Error>
Unwrap self into an Ok or an Error of the
ErrorKind::NotFound kind.
Sourcefn ok_or_unexpected_eof<C, F>(self, f: F) -> Result<T, Error>
fn ok_or_unexpected_eof<C, F>(self, f: F) -> Result<T, Error>
Unwrap self into an Ok or an Error of the
ErrorKind::UnexpectedEof kind.
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.