Skip to main content

Identified

Trait Identified 

Source
pub trait Identified {
    // Required method
    fn key(&self) -> Key;

    // Provided methods
    fn handle(&self) -> u64 { ... }
    fn model_id(&self) -> ModelId<Self>
       where Self: Sized { ... }
}
Expand description

Gives an element the stable key its paths are addressed by. Implemented by #[derive(Observable)] from the #[obs(key)] field.

Required Methods§

Source

fn key(&self) -> Key

The element’s key, read from the #[obs(key)] field.

Provided Methods§

Source

fn handle(&self) -> u64

The key as its path handle: identity for u64 keys, interned otherwise.

Source

fn model_id(&self) -> ModelId<Self>
where Self: Sized,

The typed id over the same handle. (Named to stay clear of the generated accessor for an id field, which nearly every model has.)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§