#[derive(Debug)]
pub enum ExecutableAnonymousMemoryMapCreationError
{
MMapFailed(io::Error, usize),
MLockFailed(io::Error, usize),
}
impl Display for ExecutableAnonymousMemoryMapCreationError
{
fn fmt(&self, f: &mut Formatter) -> fmt::Result
{
use self::ExecutableAnonymousMemoryMapCreationError::*;
match *self
{
MMapFailed(ref error, bytes) => write!(f, "mmap of {} aligned bytes failed with '{}'", bytes, error),
MLockFailed(ref error, bytes) => write!(f, "mlock of {} aligned bytes failed with '{}'", bytes, error),
}
}
}
impl Error for ExecutableAnonymousMemoryMapCreationError
{
#[inline(always)]
fn source(&self) -> Option<&(dyn Error + 'static)>
{
use self::ExecutableAnonymousMemoryMapCreationError::*;
match *self
{
MMapFailed(ref error, _) => Some(error),
MLockFailed(ref error, _) => Some(error),
}
}
}