#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(i32)]
pub enum PerPageMoveError
{
PageIsMappedByMultipleProcesses = EACCES,
BusyTryAgainLater = EBUSY,
Fault = EFAULT,
CanNotWriteBackPage = EIO,
DirtyPageCanNotBeMoved = EINVAL,
PageIsNotPresent = ENOENT,
OutOfMemoryOnTargetNode = ENOMEM,
}
impl Display for PerPageMoveError
{
#[inline(always)]
fn fmt(&self, f: &mut Formatter) -> fmt::Result
{
<PerPageMoveError as Debug>::fmt(self, f)
}
}
impl error::Error for PerPageMoveError
{
#[inline(always)]
fn source(&self) -> Option<&(dyn error::Error + 'static)>
{
None
}
}
impl PerPageMoveError
{
fn from_i32(error_code: i32) -> Self
{
use self::PerPageMoveError::*;
match error_code
{
EACCES => PageIsMappedByMultipleProcesses,
EBUSY => BusyTryAgainLater,
EFAULT => Fault,
EIO => CanNotWriteBackPage,
EINVAL => DirtyPageCanNotBeMoved,
ENOENT => PageIsNotPresent,
ENOMEM => OutOfMemoryOnTargetNode,
unexpected @ _ => panic!("unexpected error code '{}'", unexpected),
}
}
}