Struct PeekMut

pub struct PeekMut<'a, T, A: Allocator = Global> { pub(in ::vec::peek_mut) vec: &'a mut Vec<T, A> }

Structure wrapping a mutable reference to the last item in a Vec.

This struct is created by the peek_mut method on Vec. See its documentation for more.

Fields

vec: &'a mut Vec<T, A>

Implementations

impl<'a, T, A: Allocator> PeekMut<'a, T, A>

fn new(vec: &'a mut Vec<T, A>) -> Option<Self>
fn pop(this: Self) -> T

Removes the peeked value from the vector and returns it.

Trait Implementations

impl<'a, T, A: Allocator> Deref for PeekMut<'a, T, A>

type Target = T;
fn deref(&self) -> &Self::Target

impl<'a, T, A: Allocator> DerefMut for PeekMut<'a, T, A>

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

impl<T: Debug, A: Allocator> Debug for PeekMut<'_, T, A>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl<'a, T, A = Global> !UnwindSafe for PeekMut<'a, T, A>

impl<'a, T, A> Freeze for PeekMut<'a, T, A> where &'a mut Vec<T, A>: Freeze,

impl<'a, T, A> RefUnwindSafe for PeekMut<'a, T, A> where &'a mut Vec<T, A>: RefUnwindSafe,

impl<'a, T, A> Send for PeekMut<'a, T, A> where &'a mut Vec<T, A>: Send,

impl<'a, T, A> Sync for PeekMut<'a, T, A> where &'a mut Vec<T, A>: Sync,

impl<'a, T, A> Unpin for PeekMut<'a, T, A> where &'a mut Vec<T, A>: Unpin,

impl<'a, T, A> UnsafeUnpin for PeekMut<'a, T, A> where &'a mut Vec<T, A>: UnsafeUnpin,

Blanket Implementations

impl<P, T> Receiver for PeekMut<'a, T, A> where P: Deref<Target = T> + ?Sized, T: ?Sized,

type Target = T;

impl<T> Any for PeekMut<'a, T, A> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for PeekMut<'a, T, A> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for PeekMut<'a, T, A> where T: ?Sized,

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

impl<T> From<T> for PeekMut<'a, T, A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for PeekMut<'a, T, A> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for PeekMut<'a, T, A>

impl<T, U> Into<U> for PeekMut<'a, T, A> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for PeekMut<'a, T, A> where U: Into<T>,

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

impl<T, U> TryInto<U> for PeekMut<'a, T, A> where U: TryFrom<T>,

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