Struct awint_macro_internals::BiMap
source · [−]Expand description
This is a special purpose structure that can efficiently handle forwards and
backwards lookups and maintains the set property. A
is associated data
that is not hashed or used in equality comparisons.
Iteration over the arena is deterministic.
Implementations
sourceimpl<P: PtrTrait, T: Clone + Eq + Hash, A> BiMap<P, T, A>
impl<P: PtrTrait, T: Clone + Eq + Hash, A> BiMap<P, T, A>
pub fn new() -> Self
pub fn arena(&self) -> &Arena<P, (T, A)>
sourcepub fn arena_mut(&mut self) -> &mut Arena<P, (T, A)>
pub fn arena_mut(&mut self) -> &mut Arena<P, (T, A)>
Warning: invalidating pointers in the arena can break the BiMap
pub fn contains(&self, t: &T) -> Option<Ptr<P>>
sourcepub fn insert_with<F: FnOnce(Ptr<P>) -> A>(
&mut self,
t: T,
associate: F
) -> Result<Ptr<P>, Ptr<P>>
pub fn insert_with<F: FnOnce(Ptr<P>) -> A>(
&mut self,
t: T,
associate: F
) -> Result<Ptr<P>, Ptr<P>>
If t
is already contained, it and a
are not inserted. Returns None
if inserted a new entry (use F
to get the new Ptr<P>
), else returns
the Ptr<P>
to an already existing t
.
pub fn insert(&mut self, t: T, a: A) -> Result<Ptr<P>, Ptr<P>>
pub fn t_get<B: Borrow<T>>(&self, t: B) -> (Ptr<P>, &(T, A))
pub fn p_get<B: Borrow<Ptr<P>>>(&self, p: B) -> &(T, A)
pub fn a_get_mut<B: Borrow<Ptr<P>>>(&mut self, p: B) -> &mut A
Trait Implementations
Auto Trait Implementations
impl<P, T, A> RefUnwindSafe for BiMap<P, T, A> where
A: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<P, T, A> Send for BiMap<P, T, A> where
A: Send,
T: Send,
impl<P, T, A> Sync for BiMap<P, T, A> where
A: Sync,
T: Sync,
impl<P, T, A> Unpin for BiMap<P, T, A> where
A: Unpin,
P: Unpin,
T: Unpin,
impl<P, T, A> UnwindSafe for BiMap<P, T, A> where
A: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more