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: K
value: 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) -> bool
fn 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) -> bool
fn le(&self, other: &Self) -> bool
fn gt(&self, other: &Self) -> bool
fn 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) -> T

Returns 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) -> usize
fn 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) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses 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>