FineExt

Trait FineExt 

Source
pub trait FineExt<T, E> {
    // Required methods
    fn is_ok(&self) -> bool;
    fn is_err(&self) -> bool;
    fn ok(self) -> Option<T>;
    fn fine(self) -> T;
    fn err(self) -> Option<E>;
    fn not_fine(self) -> Result<T, E>;
    fn as_ref(&self) -> Fine<&T, &E>;
    fn as_mut(&mut self) -> Fine<&mut T, &mut E>;
    fn map<U, F>(self, op: F) -> Fine<U, E>
       where F: FnOnce(T) -> U;
    fn map_err<F, O>(self, op: O) -> Fine<T, F>
       where O: FnOnce(E) -> F;
}

Required Methods§

Source

fn is_ok(&self) -> bool

Returns true iff the Result is Ok(()).

Source

fn is_err(&self) -> bool

Returns true iff the Result is Err.

Source

fn ok(self) -> Option<T>

Converts from Fine<T, E> to Option<T>.

Only Some if the Result was Ok.

Source

fn fine(self) -> T

Unwraps the T, ignoring any Err.

Source

fn err(self) -> Option<E>

Converts from Fine<T, E> to Option<E>.

Equivalent to .1.err().

Source

fn not_fine(self) -> Result<T, E>

Converts from Fine<T, E> to Result<T, E>.

§Errors

Iff the Result was Err, in which case the T is discarded.

Source

fn as_ref(&self) -> Fine<&T, &E>

Converts from &Fine<T, E> to Fine<&T, &E>.

Produces a new Fine, containing one or two references into the original, leaving the original in place.

Source

fn as_mut(&mut self) -> Fine<&mut T, &mut E>

Converts from &mut Fine<T, E> to Fine<&mut T, &mut E>.

Produces a new Fine, containing one or two references into the original, leaving the original in place.

Source

fn map<U, F>(self, op: F) -> Fine<U, E>
where F: FnOnce(T) -> U,

Maps a Fine<T, E> to Fine<U, E>, by unconditionally applying a function to the contained T, leaving the Result untouched.

Source

fn map_err<F, O>(self, op: O) -> Fine<T, F>
where O: FnOnce(E) -> F,

Maps a Fine<T, E> to Fine<T, F>, by applying a function to a contained Err’s E, leaving the T untouched.

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.

Implementors§

Source§

impl<T, E> FineExt<T, E> for Fine<T, E>