pub struct VecMutScanItem<'s, 'a, T: 'a> { /* private fields */ }Expand description
Reference wrapper that enables item removal for VecMutScan.
Implementations§
Source§impl<'s, 'a, T: 'a> VecMutScanItem<'s, 'a, T>
impl<'s, 'a, T: 'a> VecMutScanItem<'s, 'a, T>
Sourcepub fn replace(self, value: T) -> T
pub fn replace(self, value: T) -> T
Replaces this item with a new value, returns the old value.
This is equivalent to assigning a new value or calling mem::replace on the mutable
reference obtained by using DerefMut, but can avoid an intermediate move within the
vector’s buffer.
Sourcepub fn slices(&self) -> (&[T], &[T])
pub fn slices(&self) -> (&[T], &[T])
Access the whole vector.
This provides access to the whole vector at any point during the scan. In general while scanning, the vector content is not contiguous, thus it is returned as two slices, a prefix and a suffix. The prefix contains all elements already visited while the suffix contains the remaining elements starting with this element.
This method is also present on the VecMutScan borrowed by this reference wrapper,
allowing access without an active VecMutScanItem.
Sourcepub fn slices_mut(&mut self) -> (&mut [T], &mut [T])
pub fn slices_mut(&mut self) -> (&mut [T], &mut [T])
Access and mutate the whole vector.
This provides mutable access to the whole vector at any point during the scan. In general while scanning, the vector content is not contiguous, thus it is returned as two slices, a prefix and a suffix. The prefix contains all elements already visited while the suffix contains the remaining elements starting with this element.
This method is also present on the VecMutScan borrowed by this reference wrapper,
allowing access without an active VecMutScanItem.