Skip to main content

Identifiable

Trait Identifiable 

Source
pub trait Identifiable {
    type Id: Copy + Eq + Hash;

    // Required method
    fn id(&self) -> Self::Id;
}
Expand description

Elements stored in IdentifiedVec must expose a stable identifier.

The id must not change while an element is stored in the collection. Mutating the id through IdentifiedVec::get_mut without updating the index will break lookups — prefer IdentifiedVec::update for in-place field changes.

Required Associated Types§

Source

type Id: Copy + Eq + Hash

Required Methods§

Source

fn id(&self) -> Self::Id

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§