Skip to main content

EquivalentId

Trait EquivalentId 

Source
pub trait EquivalentId<K: IntegerId> {
    // Required method
    fn as_id(&self) -> K;
}
Expand description

A type that can be for lookup as an IntegerId.

Used for key lookup in maps, similar to core::borrow::Borrow or equivalent::Equivalent. These traits are not suitable for id maps, which need conversion to integers rather than hashing/equality.

Required Methods§

Source

fn as_id(&self) -> K

Convert this type to an id K.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<K: IntegerId> EquivalentId<K> for &K

Source§

fn as_id(&self) -> K

Source§

impl<K: IntegerId> EquivalentId<K> for &mut K

Source§

fn as_id(&self) -> K

Implementors§