osom_lib_trees/traits/errors.rs
1//! Holds all custom errors for that crate.
2use osom_lib_alloc::AllocationError;
3
4/// Represents an error that can occur when working with a tree.
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6#[must_use]
7#[repr(u8)]
8pub enum TreeError {
9 /// The allocator failed to allocate memory.
10 AllocationError,
11
12 /// The tree is too big, it exceeds `MAX_LEVEL`.
13 TreeTooBig,
14}
15
16impl From<AllocationError> for TreeError {
17 fn from(_: AllocationError) -> Self {
18 TreeError::AllocationError
19 }
20}