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>

source

pub fn remove(self) -> T

Removes and returns this item from the vector.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl<'s, 'a, T: 'a> Deref for VecMutScanItem<'s, 'a, T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'s, 'a, T: 'a> DerefMut for VecMutScanItem<'s, 'a, T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'s, 'a, T: 'a> Drop for VecMutScanItem<'s, 'a, T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'s, 'a, T> RefUnwindSafe for VecMutScanItem<'s, 'a, T>where T: RefUnwindSafe,

§

impl<'s, 'a, T> !Send for VecMutScanItem<'s, 'a, T>

§

impl<'s, 'a, T> !Sync for VecMutScanItem<'s, 'a, T>

§

impl<'s, 'a, T> Unpin for VecMutScanItem<'s, 'a, T>where 'a: 's,

§

impl<'s, 'a, T> !UnwindSafe for VecMutScanItem<'s, 'a, T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.