pub struct EntryHandle<K, V> { /* private fields */ }Expand description
A handle to an entry in a LinkedHashMap.
This handle wraps a NodeHandle from the underlying linked list and
provides methods to manipulate the position of entries within the map’s
iteration order. Handles can be copied and passed around by value
regardless of the lifetime of the map.
Once an entry is removed from the map, its handle becomes invalid.
Using an invalid handle is safe - methods will return false or None
to indicate the handle is no longer valid.
§Examples
use deepmesa_collections::LinkedHashMap;
use deepmesa_collections::lhmap::Order;
let mut lhm = LinkedHashMap::<u16, &str>::new(10, Order::InsertionOrder, None);
lhm.put(1, "a");
lhm.put(2, "b");
if let Some(handle) = lhm.entry_handle(&1) {
// Move entry with key 1 to the end of iteration order
lhm.make_tail(handle);
}Trait Implementations§
Source§impl<K: Clone, V: Clone> Clone for EntryHandle<K, V>
impl<K: Clone, V: Clone> Clone for EntryHandle<K, V>
Source§fn clone(&self) -> EntryHandle<K, V>
fn clone(&self) -> EntryHandle<K, V>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<K, V> Default for EntryHandle<K, V>
impl<K, V> Default for EntryHandle<K, V>
Source§impl<K, V> PartialEq for EntryHandle<K, V>
impl<K, V> PartialEq for EntryHandle<K, V>
impl<K, V> Eq for EntryHandle<K, V>
impl<K, V> Send for EntryHandle<K, V>
impl<K, V> Sync for EntryHandle<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for EntryHandle<K, V>
impl<K, V> RefUnwindSafe for EntryHandle<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Unpin for EntryHandle<K, V>
impl<K, V> UnwindSafe for EntryHandle<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
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