pub struct ByFirst<'q, Q: ?Sized + 'q>(pub &'q Q);Expand description
Wrapper type for getting second keys/values with first keys/values via Index.
To assume that by-first is the “default” would be incorrect, so thus you one can wrap their indices with this and all is swell.
§Examples
use bidir_map::{BidirMap, ByFirst};
let mut map = BidirMap::new();
map.insert(1, "a");
assert_eq!(map[ByFirst(&1)], "a");
assert_eq!(map[&ByFirst(&1)], "a");Tuple Fields§
§0: &'q QTrait Implementations§
Source§impl<'q, Q: Ord + ?Sized + 'q> Ord for ByFirst<'q, Q>
impl<'q, Q: Ord + ?Sized + 'q> Ord for ByFirst<'q, Q>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'q, Q: PartialOrd + ?Sized + 'q> PartialOrd for ByFirst<'q, Q>
impl<'q, Q: PartialOrd + ?Sized + 'q> PartialOrd for ByFirst<'q, Q>
impl<'q, Q: Copy + ?Sized + 'q> Copy for ByFirst<'q, Q>
impl<'q, Q: Eq + ?Sized + 'q> Eq for ByFirst<'q, Q>
impl<'q, Q: ?Sized + 'q> StructuralPartialEq for ByFirst<'q, Q>
Auto Trait Implementations§
impl<'q, Q> Freeze for ByFirst<'q, Q>where
Q: ?Sized,
impl<'q, Q> RefUnwindSafe for ByFirst<'q, Q>where
Q: RefUnwindSafe + ?Sized,
impl<'q, Q> Send for ByFirst<'q, Q>
impl<'q, Q> Sync for ByFirst<'q, Q>
impl<'q, Q> Unpin for ByFirst<'q, Q>where
Q: ?Sized,
impl<'q, Q> UnwindSafe for ByFirst<'q, Q>where
Q: RefUnwindSafe + ?Sized,
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