pub trait TensorMut<Scalar: StorageElement, const MAX_RANK: usize>: TensorRef<Scalar, MAX_RANK> {
// Required method
fn as_mut_ptr(&mut self) -> *mut Scalar;
}Expand description
Mutable structural access to N-dimensional tensor containers.
TensorMut is a supertrait of TensorRef that adds a single method —
a mutable raw pointer to the first element. It is implemented by
Tensor (which owns its memory) and by TensorSpan (which borrows
a mutable sub-region). Immutable views (TensorView) deliberately do
not implement TensorMut.
Generic write-access helpers accept &mut (impl TensorMut<Scalar, R>)
so they work uniformly against owned tensors and span reborrows.
Required Methods§
Sourcefn as_mut_ptr(&mut self) -> *mut Scalar
fn as_mut_ptr(&mut self) -> *mut Scalar
Raw mutable pointer to the first storage element.
The pointer is valid for numel() / dimensions_per_value() writes
and preserves whatever stride layout TensorRef::stride_bytes
reports — callers must honour the per-axis strides when striding
through non-contiguous memory.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".