Skip to main content

sparse_vector/
element.rs

1/// A single stored position of a [`SparseVector`](crate::SparseVector).
2///
3/// This is the serialization shape: a vector serializes to its elements only, so
4/// a round trip has to carry the default value alongside.
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
6pub struct Element<T = f64> {
7    /// The position, negative or not.
8    pub index: i64,
9    /// The value stored there.
10    pub value: T,
11}