[−][src]Struct vecrem::Entry
Vec entry.
Entry allows you to remove
, read or mutate the element
behind it.
The only way to get this struct is to call Removing::next
method.
forget behavior
When Entry
destructor (drop) is not runned (this can be achieved via
mem::forget
, ManuallyDrop
, etc) the entry is not skiped and the next
call to Removing::next
returns the same entry.
use core::mem; use vecrem::VecExt; let mut vec = vec![1, 2, 3]; { let mut rem = vec.removing(); let a = rem.next().unwrap(); assert_eq!(a.value(), &1); mem::forget(a); let b = rem.next().unwrap(); assert_eq!(b.value(), &1); mem::forget(b); } assert_eq!(vec, [1, 2, 3]);
Implementations
impl<T> Entry<'_, '_, T>
[src]
pub fn remove(self) -> T
[src]
Remove element behind this entry.
pub fn value(&self) -> &T
[src]
Get access to the element behind this entry.
pub fn value_mut(&mut self) -> &mut T
[src]
Get unique access to the element behind this entry.
pub fn peek_next(&mut self) -> Option<&mut T>
[src]
Get unique access to the element after the element behind this entry.
Returns None
if this entry corresponds to the last item in the vec.
Trait Implementations
Auto Trait Implementations
impl<'a, 'rem, T> Send for Entry<'a, 'rem, T> where
T: Send,
[src]
T: Send,
impl<'a, 'rem, T> Sync for Entry<'a, 'rem, T> where
T: Sync,
[src]
T: Sync,
impl<'a, 'rem, T> Unpin for Entry<'a, 'rem, T> where
'rem: 'a,
[src]
'rem: 'a,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,