1use std::fmt;
4
5pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
6
7#[derive(Default)]
12pub struct MemCheckFailure {
13 inner: Option<BoxError>,
14}
15
16impl MemCheckFailure {
17 pub const fn new(inner: BoxError) -> Self {
19 MemCheckFailure { inner: Some(inner) }
20 }
21}
22
23impl fmt::Debug for MemCheckFailure {
24 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
25 f.write_str(format!("Failed to determine available memory: {:?}", self.inner).as_str())
26 }
27}
28
29impl fmt::Display for MemCheckFailure {
30 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
31 f.write_str(format!("Failed to determine available memory: {:?}", self.inner).as_str())
32 }
33}
34
35impl std::error::Error for MemCheckFailure {}