Skip to main content

ApplyField

Trait ApplyField 

Source
pub trait ApplyField {
    // Required method
    fn apply_field(&mut self, label: &str, value: &dyn Any) -> bool;

    // Provided method
    fn read_field(&self, label: &str) -> Option<Rc<dyn Any>> { ... }
}
Expand description

Write one captured field value back into a struct, by label. Implemented by #[derive(Observable)]; this trait is how a type-erased undo unit re-enters the store it came from.

Required Methods§

Source

fn apply_field(&mut self, label: &str, value: &dyn Any) -> bool

Provided Methods§

Source

fn read_field(&self, label: &str) -> Option<Rc<dyn Any>>

The field’s current value, cloned and type-erased; None for an unknown label. The derive implements it; Store::write_field captures priors through it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§