pub trait TensorIndex<const N: usize, const R: usize> {
type Indices: IndexIterator<R>;
// Required methods
fn offset_from_index(index: [usize; R]) -> usize;
fn indices() -> Self::Indices;
// Provided methods
fn count() -> usize { ... }
fn for_each_index(f: impl FnMut([usize; R])) { ... }
}Required Associated Types§
Required Methods§
Sourcefn offset_from_index(index: [usize; R]) -> usize
fn offset_from_index(index: [usize; R]) -> usize
Converts a valid index into a buffer offset for tensor storage.
Provided Methods§
Sourcefn for_each_index(f: impl FnMut([usize; R]))
fn for_each_index(f: impl FnMut([usize; R]))
Calls a function for each index in the tensor.
Must index over the tensor in the same order as Self::indices.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".