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

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

The reason that a monitored peer has not completed successfully.

Variants

The monitor channel is disconnected.

The monitored peer has exited with an error E.

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

Methods

impl<E> MonitorError<E>
[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);

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);

Unwraps MonitorError and returns the internal error E.

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

Trait Implementations

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

Formats the value using the given formatter. Read more

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

This method is soft-deprecated. Read more

The lower-level cause of this error, if any. Read more

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

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

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