Trait flo_binding::Changeable
source · [−]pub trait Changeable {
fn when_changed(&self, what: Arc<dyn Notifiable>) -> Box<dyn Releasable>;
}
Expand description
Trait implemented by items that can notify something when they’re changed
Required Methods
fn when_changed(&self, what: Arc<dyn Notifiable>) -> Box<dyn Releasable>
fn when_changed(&self, what: Arc<dyn Notifiable>) -> Box<dyn Releasable>
Supplies a function to be notified when this item is changed
This event is only fired after the value has been read since the most recent change. Note that this means if the value is never read, this event may never fire. This behaviour is desirable when deferring updates as it prevents large cascades of ‘changed’ events occurring for complicated dependency trees.
The releasable that’s returned has keep_alive turned off by default, so be sure to store it in a variable or call keep_alive() to keep it around (if the event never seems to fire, this is likely to be the problem)