Enum fibers::sync::oneshot::MonitorError [−][src]
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]
impl<E> MonitorError<E>
pub fn map<F, T>(self, f: F) -> MonitorError<T> where
F: FnOnce(E) -> T,
[src]
pub fn map<F, T>(self, f: F) -> MonitorError<T> where
F: FnOnce(E) -> T,
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]
pub fn unwrap_or(self, or_error: E) -> E
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]
pub fn unwrap_or_else<F>(self, f: F) -> E where
F: FnOnce() -> E,
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]
impl<E: Debug> Debug for MonitorError<E>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<E: Clone> Clone for MonitorError<E>
[src]
impl<E: Clone> Clone for MonitorError<E>
fn clone(&self) -> MonitorError<E>
[src]
fn clone(&self) -> MonitorError<E>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<E: PartialEq> PartialEq for MonitorError<E>
[src]
impl<E: PartialEq> PartialEq for MonitorError<E>
fn eq(&self, other: &MonitorError<E>) -> bool
[src]
fn eq(&self, other: &MonitorError<E>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &MonitorError<E>) -> bool
[src]
fn ne(&self, other: &MonitorError<E>) -> bool
This method tests for !=
.
impl<E: Eq> Eq for MonitorError<E>
[src]
impl<E: Eq> Eq for MonitorError<E>
impl<E: Error> Error for MonitorError<E>
[src]
impl<E: Error> Error for MonitorError<E>
fn description(&self) -> &str
[src]
fn description(&self) -> &str
This method is soft-deprecated. Read more
fn cause(&self) -> Option<&Error>
[src]
fn cause(&self) -> Option<&Error>
The lower-level cause of this error, if any. Read more
impl<E: Display> Display for MonitorError<E>
[src]
impl<E: Display> Display for MonitorError<E>
Auto Trait Implementations
impl<E> Send for MonitorError<E> where
E: Send,
impl<E> Send for MonitorError<E> where
E: Send,
impl<E> Sync for MonitorError<E> where
E: Sync,
impl<E> Sync for MonitorError<E> where
E: Sync,