pub struct Entry<'a, 'rem, T> { /* private fields */ }Expand description
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§
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'rem, T> Freeze for Entry<'a, 'rem, T>
impl<'a, 'rem, T> RefUnwindSafe for Entry<'a, 'rem, T>where
T: RefUnwindSafe,
impl<'a, 'rem, T> Send for Entry<'a, 'rem, T>where
T: Send,
impl<'a, 'rem, T> Sync for Entry<'a, 'rem, T>where
T: Sync,
impl<'a, 'rem, T> Unpin for Entry<'a, 'rem, T>
impl<'a, 'rem, T> UnsafeUnpin for Entry<'a, 'rem, T>
impl<'a, 'rem, T> !UnwindSafe for Entry<'a, 'rem, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more