async_backplane/
fault.rs

1use crate::DeviceID;
2
3/// The device has disconnected and it wasn't for a good reason.
4#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
5pub enum Fault {
6    /// Wasn't scheduled on an executor.
7    Drop,
8    /// Return an Err or panicked or generally something bad.
9    Error,
10    /// A device we depended on faulted.
11    Cascade(DeviceID),
12}
13
14impl Fault {
15
16    /// Did the Device drop without being scheduled?
17    pub fn is_drop(&self) -> bool { *self == Fault::Drop }
18
19    /// Did we return an Err or panic or something awful?
20    pub fn is_error(&self) -> bool { *self == Fault::Error }
21
22    /// Are we a cascade fault?
23    pub fn is_cascade(&self) -> bool { matches!(self, Fault::Cascade(_)) }
24    
25}