osom_lib_arrays/
errors.rs

1//! Holds all custom errors for that crate.
2use osom_lib_alloc::AllocationError;
3
4/// Represents an error that occurs when constructing a new array.
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6#[must_use]
7#[repr(u8)]
8pub enum ArrayConstructionError {
9    /// The allocator failed to allocate memory.
10    AllocationError,
11
12    /// The passed array is too long, it exceeds `MAX_LENGTH`.
13    ArrayTooLong,
14}
15
16impl From<AllocationError> for ArrayConstructionError {
17    fn from(_: AllocationError) -> Self {
18        ArrayConstructionError::AllocationError
19    }
20}