pub trait IndexInt:
Copy
+ Send
+ Sync
+ 'static {
// Required method
fn to_usize(self) -> usize;
}Expand description
Trait for index element types.
All indices within a single CachedFunction must use the same integer type.
Implemented for u8, u16, u32, and usize. Use u8 for quantics TCI
where local_dim = 2.
§Examples
use tensor4all_tcicore::{IndexInt, CachedFunction};
// Using u8 indices for quantics (local_dim = 2)
let cf = CachedFunction::new(
|idx: &[u8]| idx.iter().map(|&x| x as usize).sum::<usize>(),
&[2, 2, 2],
).unwrap();
assert_eq!(cf.eval(&[1u8, 0, 1]), 2);Required Methods§
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.