wasmtime_internal_error/
oom.rs1use super::OomOrDynError;
2use core::fmt;
3
4#[derive(Clone, Copy, Default)]
15pub struct OutOfMemory {
16 _private: (),
17}
18
19impl fmt::Debug for OutOfMemory {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 f.write_str("OutOfMemory")
22 }
23}
24
25impl fmt::Display for OutOfMemory {
26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27 f.write_str("out of memory")
28 }
29}
30
31impl core::error::Error for OutOfMemory {
32 #[inline]
33 fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
34 None
35 }
36}
37
38impl OutOfMemory {
39 #[inline]
43 pub const fn new() -> Self {
44 Self { _private: () }
45 }
46}
47
48impl From<OutOfMemory> for OomOrDynError {
49 fn from(OutOfMemory { _private: () }: OutOfMemory) -> Self {
50 OomOrDynError::OOM
51 }
52}