stumpalo 0.5.1

A fast, zero-dependency, memory efficient bump allocator with chunk reuse and scoped stack support
Documentation
use core::alloc::LayoutError;

pub(crate) const OOM_ERR_STR: &str = "out of memory";

#[derive(Debug)]
pub enum Error {
    LayoutError(LayoutError),
    OOM,
}

impl core::fmt::Display for Error {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        match self {
            Error::LayoutError(e) => core::fmt::Display::fmt(e, f),
            Error::OOM => f.write_str(OOM_ERR_STR),
        }
    }
}

impl core::error::Error for Error {}

impl From<LayoutError> for Error {
    fn from(value: LayoutError) -> Self {
        Error::LayoutError(value)
    }
}