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_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_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.
Object Safety§
This trait is not object safe.