[][src]Enum fibers::sync::oneshot::MonitorError

pub enum MonitorError<E> {
    Aborted,
    Failed(E),
}

The reason that a monitored peer has not completed successfully.

Variants

Aborted

The monitor channel is disconnected.

Failed(E)

The monitored peer has exited with an error E.

i.e., Monitored::exit(self, Err(E)) was called

Methods

impl<E> MonitorError<E>[src]

pub fn map<F, T>(self, f: F) -> MonitorError<T> where
    F: FnOnce(E) -> T, 
[src]

Maps an MonitorError<E> to MonitorError<T> by applying a function to a contained error.

Examples

use fibers::sync::oneshot::MonitorError;

let mut e = MonitorError::Failed(10);
assert_eq!(e.map(|v| v.to_string()), MonitorError::Failed("10".to_string()));

e = MonitorError::Aborted;
assert_eq!(e.map(|v| v.to_string()), MonitorError::Aborted);

pub fn unwrap_or(self, or_error: E) -> E[src]

Unwraps MonitorError and returns the internal error E.

If self is MonitorError::Aborted, or_error will be returned.

Examples

use fibers::sync::oneshot::MonitorError;

let e = MonitorError::Aborted;
assert_eq!(e.unwrap_or(10), 10);

let e = MonitorError::Failed(20);
assert_eq!(e.unwrap_or(10), 20);

pub fn unwrap_or_else<F>(self, f: F) -> E where
    F: FnOnce() -> E, 
[src]

Unwraps MonitorError and returns the internal error E.

If self is MonitorError::Aborted, the result of f() will be returned.

Trait Implementations

impl<E: Clone> Clone for MonitorError<E>[src]

impl<E: Eq> Eq for MonitorError<E>[src]

impl<E: PartialEq> PartialEq<MonitorError<E>> for MonitorError<E>[src]

impl<E: Display> Display for MonitorError<E>[src]

impl<E: Debug> Debug for MonitorError<E>[src]

impl<E> StructuralPartialEq for MonitorError<E>[src]

impl<E> StructuralEq for MonitorError<E>[src]

impl<E: Error> Error for MonitorError<E>[src]

Auto Trait Implementations

impl<E> Send for MonitorError<E> where
    E: Send

impl<E> Sync for MonitorError<E> where
    E: Sync

impl<E> Unpin for MonitorError<E> where
    E: Unpin

impl<E> UnwindSafe for MonitorError<E> where
    E: UnwindSafe

impl<E> RefUnwindSafe for MonitorError<E> where
    E: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]