pub trait VectorViewSparse<T: ?Sized>: VectorView<T> {
type Iter<'a>: Iterator<Item = (usize, &'a T)>
where Self: 'a,
T: 'a;
// Required method
fn nontrivial_entries<'a>(&'a self) -> Self::Iter<'a>;
}
Expand description
View on a sequence type that stores its data in a sparse format.
This clearly requires that the underlying type T
has some notion
of a “zero” element.
Required Associated Types§
Required Methods§
Sourcefn nontrivial_entries<'a>(&'a self) -> Self::Iter<'a>
fn nontrivial_entries<'a>(&'a self) -> Self::Iter<'a>
Returns an iterator over all elements of the sequence with their indices
that are “nonzero” (T
must have an appropriate notion of zero).
§Example
let mut vector = SparseMapVector::new(10, StaticRing::<i64>::RING);
*vector.at_mut(2) = 100;
assert_eq!(vec![(2, 100)], vector.nontrivial_entries().map(|(i, x)| (i, *x)).collect::<Vec<_>>());
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.