Skip to content

Commit 932b0df

Browse files
author
maxtremblay
committed
Add small documentation to error
1 parent 129b72d commit 932b0df

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/error.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1+
//! Error types for matrix and vector operations.
2+
//!
3+
//! This contains two kind of errors.
4+
//! [`PositionsError`](PositionsError) represents errors
5+
//! when building a vector or matrix with invalid positions.
6+
//! [`IncompatibleDimensions`](IncompatibleDimensions) represents errors
7+
//! when two objects have incompatible dimensions for a given operations
8+
//! such as addition or multiplication.
9+
110
use is_sorted::IsSorted;
211
use itertools::Itertools;
312
use std::fmt;
413

14+
/// An error to represent invalid positions in a vector or matrix.
515
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
616
pub enum PositionsError {
717
Unsorted,
@@ -36,6 +46,8 @@ pub(crate) fn validate_positions(length: usize, positions: &[usize]) -> Result<(
3646
Ok(())
3747
}
3848

49+
/// An error to represent incompatible dimensions
50+
/// in matrix and vector operations.
3951
#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)]
4052
pub struct IncompatibleDimensions<DL, DR> {
4153
left_dimensions: DL,

0 commit comments

Comments
 (0)