Skip to main content

KeyExt

Trait KeyExt 

Source
pub trait KeyExt: Sized {
    // Required method
    fn write_key(&mut self) -> &mut DiffKey;

    // Provided method
    fn key(self, key: impl Hash) -> Self
       where Self: 'static { ... }
}
Expand description

Trait for giving an element a stable identity across renders.

Required Methods§

Source

fn write_key(&mut self) -> &mut DiffKey

Returns a mutable reference to the element’s diff key.

Provided Methods§

Source

fn key(self, key: impl Hash) -> Self
where Self: 'static,

Assign a key derived from any hashable value, used to reconcile elements in dynamic lists. The key is scoped to the element’s type, so the same value used on different element or component types never collides.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§