ps_alloc/
error.rs

1use std::alloc::LayoutError;
2
3use thiserror::Error;
4
5#[derive(Debug, Error, PartialEq, Eq, Clone)]
6pub enum AllocationError {
7    #[error("An arithmetic error occured.")]
8    ArithmeticError,
9    #[error(transparent)]
10    LayoutError(#[from] LayoutError),
11    #[error("Process ran out of memory.")]
12    OutOfMemory,
13}
14
15#[derive(Debug, Error, PartialEq, Eq, Clone)]
16pub enum DeallocationError {
17    #[error("This memory was already freed.")]
18    DoubleFree,
19    #[error("The pointer provided was not properly aligned.")]
20    ImproperAlignment,
21    #[error("Tried to free memory not allocated by this crate.")]
22    InvalidAllocation,
23    #[error(transparent)]
24    LayoutError(#[from] LayoutError),
25    #[error("Tried to free a null pointer.")]
26    NullPtr,
27}