use std::fmt;
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
#[derive(Default)]
pub struct MemCheckFailure {
inner: Option<BoxError>,
}
impl MemCheckFailure {
pub const fn new(inner: BoxError) -> Self {
MemCheckFailure { inner: Some(inner) }
}
}
impl fmt::Debug for MemCheckFailure {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(format!("Failed to determine available memory: {:?}", self.inner).as_str())
}
}
impl fmt::Display for MemCheckFailure {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(format!("Failed to determine available memory: {:?}", self.inner).as_str())
}
}
impl std::error::Error for MemCheckFailure {}