pub trait ArrayDataMutExt<T: ArrayDType>: SealedArrayDataMutExt {
// Required method
fn with_slice_mut<O>(&mut self, with: impl FnOnce(&mut [T]) -> O) -> O;
}Expand description
Extension trait for ArrayBase where the data provides mutable access
and implements DataMut.
This trait is sealed and cannot be implemented in your code, but is
provided for all arrays over element types implementing ArrayDType.
Required Methods§
Sourcefn with_slice_mut<O>(&mut self, with: impl FnOnce(&mut [T]) -> O) -> O
fn with_slice_mut<O>(&mut self, with: impl FnOnce(&mut [T]) -> O) -> O
Provides access to the array’s data as a mutable slice.
If the array is contiguous and in standard order, i.e. if the element order in memory corresponds to the logical order of the array’s elements, a mutable view of the data is returned without cloning.
Otherwise, the data is cloned and put into standard order first, and later copied back into the array.
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.