pub struct RegionMut<'a, T>(/* private fields */);Expand description
A region of two separate mutable slices that represent continuous data.
This is the mutable equivalent to Region, allowing mutable access to the contained slices.
Implementations§
Source§impl<'a, T> RegionMut<'a, T>
impl<'a, T> RegionMut<'a, T>
Sourcepub fn new(slice_0: &'a mut [T], slice_1: &'a mut [T]) -> Self
pub fn new(slice_0: &'a mut [T], slice_1: &'a mut [T]) -> Self
Creates a region with two mutable slices.
The slices should represent continuous data, where slice_0 goes before slice_1.
Sourcepub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter(&self) -> impl Iterator<Item = &T>
Returns an iterator over the region.
The iterator yields all items from start to end.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>
Returns an iterator that allows modifying each value.
The iterator yields all items from start to end.
Sourcepub fn contiguous(&self) -> &[T]
pub fn contiguous(&self) -> &[T]
Returns the first contiguous slice in the region.
The slice will not necessarily contain all data in the region.
Sourcepub fn contiguous_mut(&mut self) -> &mut [T]
pub fn contiguous_mut(&mut self) -> &mut [T]
Returns a mutable reference to the first contiguous slice in the region.
The slice will not necessarily contain all data in the region.
Source§impl<'a, T> RegionMut<'a, T>where
T: Copy,
impl<'a, T> RegionMut<'a, T>where
T: Copy,
Sourcepub fn copy_to_slice(&self, slice: &mut [T])
pub fn copy_to_slice(&self, slice: &mut [T])
Copies all elements in the region into dest, using a memcpy.
The length of dest must be the same as self.
If T does not implement Copy, use clone_to_slice.
§Panics
This function will panic if dest has a different length to self.
Sourcepub fn copy_from_slice(&mut self, src: &[T])
pub fn copy_from_slice(&mut self, src: &[T])
Copies all elements from src into the region, using a memcpy.
The length of src must be the same as self.
If T does not implement Copy, use clone_from_slice.
§Panics
This function will panic if src has a different length to self.
Source§impl<'a, T> RegionMut<'a, T>where
T: Clone,
impl<'a, T> RegionMut<'a, T>where
T: Clone,
Sourcepub fn clone_to_slice(&self, slice: &mut [T])
pub fn clone_to_slice(&self, slice: &mut [T])
Copies all elements in the region into dest.
The length of dest must be the same as self.
§Panics
This function will panic if dest has a different length to self.
Sourcepub fn clone_from_slice(&mut self, src: &[T])
pub fn clone_from_slice(&mut self, src: &[T])
Copies all elements from src into the region.
The length of src must be the same as self.
§Panics
This function will panic if src has a different length to self.