KeyExtractor

Trait KeyExtractor 

Source
pub trait KeyExtractor<'a, T> {
    type Key: Hash;

    // Required method
    fn extract(&self, from: &'a T) -> Self::Key;
}
Expand description

Extracts the key from the value, allowing KeyedSet to obtain its values’ keys.

Required Associated Types§

Source

type Key: Hash

The type of the key extracted by the extractor.

Required Methods§

Source

fn extract(&self, from: &'a T) -> Self::Key

Extracts the key from the value, allowing KeyedSet to obtain its values’ keys.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + Hash> KeyExtractor<'a, T> for ()

Source§

type Key = &'a T

Source§

fn extract(&self, from: &'a T) -> Self::Key

Implementors§

Source§

impl<'a, T: 'a, U: Hash, F: Fn(&'a T) -> U> KeyExtractor<'a, T> for F

Source§

type Key = U