Skip to content

Have a structured IndexOutOfBoundsError type #267

Open
@ValuedMammal

Description

@ValuedMammal

This would be convenient to be able to reuse in a variety of contexts, rather than duplicate a similar error for every error enum.

Proposal

src/types.rs

/// Index out of bounds error.
#[derive(Debug, Clone, Copy)]
pub struct IndexOutOfBoundsError {
    /// The index that is out of range.
    pub index: usize,
    /// The length of the container.
    pub len: usize,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions