Struct KeyAndValue
pub(crate) struct KeyAndValue<K, V> { pub key: K, pub value: V }
A pair where ordering and equality work on only the key, ignoring the value.
Used to implement Iterator::min_by_key as map+min, for example.
Fields
key: Kvalue: V
Trait Implementations
impl<K: Clone, V: Clone> Clone for KeyAndValue<K, V>
fn clone(&self) -> KeyAndValue<K, V>
impl<K: Copy, V: Copy> Copy for KeyAndValue<K, V>
impl<K: Debug, V: Debug> Debug for KeyAndValue<K, V>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<K: Eq, V> Eq for KeyAndValue<K, V>
impl<K: Ord, V> Ord for KeyAndValue<K, V>
fn cmp(&self, other: &Self) -> Ordering
impl<K: PartialEq, V> PartialEq for KeyAndValue<K, V>
fn eq(&self, other: &Self) -> boolfn ne(&self, other: &Self) -> bool
impl<K: PartialOrd, V> PartialOrd for KeyAndValue<K, V>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>fn lt(&self, other: &Self) -> boolfn le(&self, other: &Self) -> boolfn gt(&self, other: &Self) -> boolfn ge(&self, other: &Self) -> bool
Auto Trait Implementations
impl<K, V> Freeze for KeyAndValue<K, V>
where
K: Freeze,
V: Freeze,
impl<K, V> RefUnwindSafe for KeyAndValue<K, V>
where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for KeyAndValue<K, V>
where
K: Send,
V: Send,
impl<K, V> Sync for KeyAndValue<K, V>
where
K: Sync,
V: Sync,
impl<K, V> Unpin for KeyAndValue<K, V>
where
K: Unpin,
V: Unpin,
impl<K, V> UnsafeUnpin for KeyAndValue<K, V>
where
K: UnsafeUnpin,
V: UnsafeUnpin,
impl<K, V> UnwindSafe for KeyAndValue<K, V>
where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for KeyAndValue<K, V>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for KeyAndValue<K, V>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for KeyAndValue<K, V>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for KeyAndValue<K, V>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for KeyAndValue<K, V>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Printable for KeyAndValue<K, V>
where
T: Copy + Debug,
impl<T> SizeHint for KeyAndValue<K, V>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for KeyAndValue<K, V>
impl<T, U> Into<U> for KeyAndValue<K, V>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for KeyAndValue<K, V>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for KeyAndValue<K, V>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>