Skip to content

modularize error CollectionAllocErr #513

Description

@alejandro-vaz

the error type for SmallVec is defined on lib.rs:141 as follows:

/// Error type for APIs with fallible heap allocation
#[derive(Debug)]
pub enum CollectionAllocErr {
    /// Overflow `usize::MAX` or other error during size computation
    CapacityOverflow,
    /// The allocator return an error
    AllocErr {
        /// The layout that was passed to the allocator
        layout: Layout
    }
}
impl core::fmt::Display for CollectionAllocErr {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "Allocation error: {:?}", self)
    }
}

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

move the full enum + all implementations to errors.rs

make sure the code compiles and everything works after that

the type must still be exported on the public API, which will mean that a re-export on lib.rs needs to be added

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for a first contributorhelp wantedNo clear candidate to implement itp-highhigh priorityr-refactorrelated to refactoring

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions