diff --git a/crates/servicepoint/src/primitive_grid.rs b/crates/servicepoint/src/primitive_grid.rs index 93c4249..882a1a5 100644 --- a/crates/servicepoint/src/primitive_grid.rs +++ b/crates/servicepoint/src/primitive_grid.rs @@ -13,12 +13,25 @@ pub struct PrimitiveGrid { data: Vec, } +/// Error type for methods that change a whole column or row at once #[derive(thiserror::Error, Debug, PartialEq)] pub enum SeriesError { #[error("The index {index} was out of bounds for size {size}")] - OutOfBounds { index: usize, size: usize }, + /// The index {index} was out of bounds for size {size} + OutOfBounds { + /// the index where access was tried + index: usize, + /// the size in that direction + size: usize, + }, #[error("The provided series was expected to have a length of {expected}, but was {actual}")] - InvalidLength { actual: usize, expected: usize }, + /// The provided series was expected to have a length of {expected}, but was {actual} + InvalidLength { + /// actual size of the provided series + actual: usize, + /// expected size + expected: usize, + }, } impl PrimitiveGrid { @@ -189,7 +202,10 @@ impl PrimitiveGrid { { Ok(()) } else { - Err(SeriesError::OutOfBounds {index: x, size: width}) + Err(SeriesError::OutOfBounds { + index: x, + size: width, + }) } }