pub trait TensorMapTrait<T>{
// Required methods
fn shape(&self) -> &[usize];
fn unmap(&mut self);
fn as_slice(&self) -> &[T];
fn as_mut_slice(&mut self) -> &mut [T];
fn is_writable(&self) -> bool;
// Provided methods
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
fn size(&self) -> usize { ... }
fn view(&self) -> Result<ArrayView<'_, T, Dim<IxDynImpl>>> { ... }
fn view_mut(&mut self) -> Result<ArrayViewMut<'_, T, Dim<IxDynImpl>>> { ... }
}Required Methods§
Sourcefn as_mut_slice(&mut self) -> &mut [T]
fn as_mut_slice(&mut self) -> &mut [T]
Get a mutable slice to the data in this tensor map.
Sourcefn is_writable(&self) -> bool
fn is_writable(&self) -> bool
Whether this mapping permits writes – i.e. whether the coherency bracket it holds will flush on release.
The single source of truth for a binding that has to advertise
mutability to a foreign consumer (the Python buffer protocol’s
readonly flag, say). Deriving that from the access a caller
requested instead would leave the advertisement agreeing with the
request while both disagreed with the mapping actually taken.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".