
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum MailboxStatus {

    Pending        =  0,

    Success        =  1,

    Timeout        = -1,

    Cancelled      = -2,

    MailboxError   = -3,

    ProtoMismatch  = -4,

    CounterFail    = -5,

    WkcFail        = -6,

    NoMemory       = -7,

    InvalidArg     = -8,

    NotImplemented = -9,
}

impl From<i32> for MailboxStatus {
    fn from(v: i32) -> Self {
        match v {
            0 => Self::Pending,
            1 => Self::Success,
            -1 => Self::Timeout,
            -2 => Self::Cancelled,
            -3 => Self::MailboxError,
            -4 => Self::ProtoMismatch,
            -5 => Self::CounterFail,
            -6 => Self::WkcFail,
            -7 => Self::NoMemory,
            -8 => Self::InvalidArg,
            -9 => Self::NotImplemented,
            _ => Self::InvalidArg,
        }
    }
}

impl Default for MailboxStatus {
    fn default() -> Self { Self::Pending }
}
