uni_sparse_vector/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error, Clone, PartialEq)]
5pub enum SparseError {
6 #[error("SV-1: indices ({indices}) and values ({values}) must have equal length")]
8 LengthMismatch { indices: usize, values: usize },
9
10 #[error(
12 "SV-2: indices must be strictly ascending (sorted + unique); violation at position {position} ({prev} >= {curr})"
13 )]
14 UnsortedIndices {
15 position: usize,
16 prev: u32,
17 curr: u32,
18 },
19
20 #[error("SV-3: weight at position {position} is non-finite ({value})")]
22 NonFiniteWeight { position: usize, value: f32 },
23
24 #[error("SV-4: encoded buffer truncated: need {need} bytes, got {got}")]
26 Truncated { need: usize, got: usize },
27
28 #[error("SV-5: encoded buffer has {trailing} unexpected trailing byte(s)")]
30 TrailingBytes { trailing: usize },
31}