pub trait SparseTensor<T, A: Addressable> {
// Required methods
fn new(address_value_map: HashMap<A, T>) -> Self;
fn get(&self, address: &A) -> Option<&T>;
fn get_mut(&mut self, address: &A) -> Option<&mut T>;
fn set(&mut self, address: &A, value: T) -> Option<T>;
fn iter(&self) -> Iter<'_, A, T>;
fn iter_mut(&mut self) -> IterMut<'_, A, T>;
}Required Methods§
Sourcefn new(address_value_map: HashMap<A, T>) -> Self
fn new(address_value_map: HashMap<A, T>) -> Self
Creates a new instance of a sparse tensor given the address-value-map
Sourcefn get(&self, address: &A) -> Option<&T>
fn get(&self, address: &A) -> Option<&T>
Attempts to retrieve a reference to the value at the address. Returns None if the address is outside the given bound
fn get_mut(&mut self, address: &A) -> Option<&mut T>
Sourcefn set(&mut self, address: &A, value: T) -> Option<T>
fn set(&mut self, address: &A, value: T) -> Option<T>
Attempts to reassign the value at the given index. Returns Err if the given address is out of bounds.
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.