pub struct Ptr(/* private fields */);Expand description
A pointer type used to identify entries in the linked hash map.
This is an opaque handle that can be used to directly access entries without key lookup. It provides O(1) access to entries. It is non-generational, meaning that once an entry is removed, the pointer may be re-used for a new entry.
§Examples
use tether_map::Entry;
use tether_map::LinkedHashMap;
use tether_map::Ptr;
let mut map = LinkedHashMap::new();
let ptr = match map.entry("key") {
Entry::Vacant(entry) => entry.insert_tail(42).0,
Entry::Occupied(entry) => entry.ptr(),
};
// Use the pointer for direct access
assert_eq!(map.ptr_get(ptr), Some(&42));Trait Implementations§
Source§impl<K, T, S> Index<Ptr> for LinkedHashMap<K, T, S>
impl<K, T, S> Index<Ptr> for LinkedHashMap<K, T, S>
Source§impl<K, T, S> IndexMut<Ptr> for LinkedHashMap<K, T, S>
impl<K, T, S> IndexMut<Ptr> for LinkedHashMap<K, T, S>
Source§impl Ord for Ptr
impl Ord for Ptr
Source§impl PartialOrd for Ptr
impl PartialOrd for Ptr
impl Copy for Ptr
impl Eq for Ptr
impl StructuralPartialEq for Ptr
Auto Trait Implementations§
impl Freeze for Ptr
impl RefUnwindSafe for Ptr
impl Send for Ptr
impl Sync for Ptr
impl Unpin for Ptr
impl UnwindSafe for Ptr
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