1#[cfg(all(feature = "alloc_api2", not(feature = "alloc_unstable")))]
12mod alloc_api2;
13#[cfg(feature = "alloc_unstable")]
14mod alloc_unstable;
15mod alt_alloc;
16#[cfg(feature = "std_alloc")]
17mod std_alloc;
18
19#[cfg(feature = "alloc_unstable")]
20pub use core::alloc::AllocError;
21
22#[cfg(not(feature = "alloc_unstable"))]
23pub use alloc_error::AllocError;
24pub use alt_alloc::AltAllocator;
25#[cfg(feature = "std_alloc")]
26pub use std_alloc::Global;
27
28#[cfg(not(feature = "alloc_unstable"))]
29mod alloc_error {
30 use core::error::Error;
31 use core::fmt;
32
33 #[derive(Debug, Copy, Clone, PartialEq, Eq)]
38 pub struct AllocError;
39
40 impl Error for AllocError {}
41
42 impl fmt::Display for AllocError {
43 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44 f.write_str("A memory allocation error occurred.")
45 }
46 }
47}