Trait blazesym::IntoError

source ·
pub trait IntoError<T>: Sealed
where 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§

source

fn ok_or_error<C, F>(self, kind: ErrorKind, f: F) -> Result<T, Error>
where C: ToString, F: FnOnce() -> C,

Unwrap self into an Ok or an Error of the given kind.

Provided Methods§

source

fn ok_or_invalid_data<C, F>(self, f: F) -> Result<T, Error>
where C: ToString, F: FnOnce() -> C,

Unwrap self into an Ok or an Error of the ErrorKind::InvalidData kind.

source

fn ok_or_invalid_input<C, F>(self, f: F) -> Result<T, Error>
where C: ToString, F: FnOnce() -> C,

Unwrap self into an Ok or an Error of the ErrorKind::InvalidInput kind.

source

fn ok_or_unexpected_eof<C, F>(self, f: F) -> Result<T, Error>
where C: ToString, F: FnOnce() -> C,

Unwrap self into an Ok or an Error of the ErrorKind::UnexpectedEof kind.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> IntoError<T> for Option<T>

source§

fn ok_or_error<C, F>(self, kind: ErrorKind, f: F) -> Result<T, Error>
where C: ToString, F: FnOnce() -> C,

Implementors§