Stable, no_std
-compatible, fallible heap allocation for [Box
].
Basic usage is as follows:
match new
You may drop the object after allocation failure instead,
choosing to e.g propogate or wrap the [Error
].
Care has been taken to optimize the size of [Error
] down to a single usize:
assert_eq!;
And to provide ergonomic error messages:
memory allocation of 4 bytes (for type i32) failed
memory allocation of 2.44 kibibytes (for type [u8; 2500]) failed
Conversions to [std::io::Error
] and [std::io::ErrorKind::OutOfMemory
]
are provided when the "std"
feature is enabled:
Comparison with other crates
fallacy-box
fallible_collections
- You must use either the
TryBox
wrapper struct, or theFallibleBox
extension trait. - The returned error type doesn't implement common error traits, and isn't strictly minimal.
- You must use either the