Trait PwmEquivalent

Source
pub trait PwmEquivalent: Pwm {
    // Required methods
    fn get_equivalent<Q>(
        &self,
        key: &Q,
    ) -> Result<Option<&EntryValue<Self::Value>>, Self::Error>
       where Self::Key: Borrow<Q>,
             Q: Hash + Eq + ?Sized;
    fn get_entry_equivalent<Q>(
        &self,
        key: &Q,
    ) -> Result<Option<(&Self::Key, &EntryValue<Self::Value>)>, Self::Error>
       where Self::Key: Borrow<Q>,
             Q: Hash + Eq + ?Sized;
    fn contains_key_equivalent<Q>(&self, key: &Q) -> Result<bool, Self::Error>
       where Self::Key: Borrow<Q>,
             Q: Hash + Eq + ?Sized;
    fn remove_entry_equivalent<Q>(
        &mut self,
        key: &Q,
    ) -> Result<Option<(Self::Key, EntryValue<Self::Value>)>, Self::Error>
       where Self::Key: Borrow<Q>,
             Q: Hash + Eq + ?Sized;
}
Expand description

An optimized version of the Pwm trait that if your pending writes manager is depend on hash.

Required Methods§

Source

fn get_equivalent<Q>( &self, key: &Q, ) -> Result<Option<&EntryValue<Self::Value>>, Self::Error>
where Self::Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Optimized version of Pwm::get that accepts borrowed keys.

Source

fn get_entry_equivalent<Q>( &self, key: &Q, ) -> Result<Option<(&Self::Key, &EntryValue<Self::Value>)>, Self::Error>
where Self::Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Optimized version of Pwm::get_entry that accepts borrowed keys.

Source

fn contains_key_equivalent<Q>(&self, key: &Q) -> Result<bool, Self::Error>
where Self::Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Optimized version of Pwm::contains_key that accepts borrowed keys.

Source

fn remove_entry_equivalent<Q>( &mut self, key: &Q, ) -> Result<Option<(Self::Key, EntryValue<Self::Value>)>, Self::Error>
where Self::Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Optimized version of Pwm::remove_entry that accepts borrowed keys.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<K, V, S> PwmEquivalent for IndexMap<K, EntryValue<V>, S>
where K: Eq + Hash, S: BuildHasher + Default,

Source§

fn get_equivalent<Q>( &self, key: &Q, ) -> Result<Option<&EntryValue<V>>, <IndexMap<K, EntryValue<V>, S> as Pwm>::Error>
where <IndexMap<K, EntryValue<V>, S> as Pwm>::Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source§

fn get_entry_equivalent<Q>( &self, key: &Q, ) -> Result<Option<(&<IndexMap<K, EntryValue<V>, S> as Pwm>::Key, &EntryValue<<IndexMap<K, EntryValue<V>, S> as Pwm>::Value>)>, <IndexMap<K, EntryValue<V>, S> as Pwm>::Error>
where <IndexMap<K, EntryValue<V>, S> as Pwm>::Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source§

fn contains_key_equivalent<Q>( &self, key: &Q, ) -> Result<bool, <IndexMap<K, EntryValue<V>, S> as Pwm>::Error>
where <IndexMap<K, EntryValue<V>, S> as Pwm>::Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Source§

fn remove_entry_equivalent<Q>( &mut self, key: &Q, ) -> Result<Option<(K, EntryValue<V>)>, <IndexMap<K, EntryValue<V>, S> as Pwm>::Error>
where <IndexMap<K, EntryValue<V>, S> as Pwm>::Key: Borrow<Q>, Q: Hash + Eq + ?Sized,

Implementors§