#[derive(Debug)]
pub enum RdmaParseError
{
Input(io::Error),
DuplicateDevice
{
#[allow(missing_docs)]
device_name: RdmaDeviceName,
},
MissingKeyValueFields
{
#[allow(missing_docs)]
device_name: RdmaDeviceName,
},
DuplicateStatisticName
{
name: Vec<u8>,
},
MissingStatisticValue
{
name: &'static [u8],
},
InvalidStatisticValue
{
name: &'static [u8],
value: Vec<u8>,
cause: ParseNumberError,
},
MissingStatistic
{
#[allow(missing_docs)]
name: &'static [u8]
},
}
impl Display for RdmaParseError
{
#[inline(always)]
fn fmt(&self, f: &mut Formatter) -> fmt::Result
{
Debug::fmt(self, f)
}
}
impl Error for RdmaParseError
{
#[inline(always)]
fn source(&self) -> Option<&(dyn Error + 'static)>
{
use self::RdmaParseError::*;
match self
{
&Input(ref source) => Some(source),
&DuplicateDevice { .. } => None,
&MissingKeyValueFields { .. } => None,
&DuplicateStatisticName { .. } => None,
&MissingStatisticValue { .. } => None,
&InvalidStatisticValue { ref cause, .. } => Some(cause),
&MissingStatistic { .. } => None,
}
}
}
impl From<io::Error> for RdmaParseError
{
#[inline(always)]
fn from(value: io::Error) -> Self
{
RdmaParseError::Input(value)
}
}