Trait tokens::ChangeToken
source · pub trait ChangeToken: Send + Sync {
// Required methods
fn changed(&self) -> bool;
fn register(
&self,
callback: Callback,
state: Option<Arc<dyn Any>>
) -> Registration;
// Provided method
fn must_poll(&self) -> bool { ... }
}
Expand description
Propagates notifications that a change has occurred.
Required Methods§
sourcefn register(
&self,
callback: Callback,
state: Option<Arc<dyn Any>>
) -> Registration
fn register( &self, callback: Callback, state: Option<Arc<dyn Any>> ) -> Registration
Registers for a callback that will be invoked when the token has changed.
Arguments
callback
- The callback to invokestate
- The optional state provided to the callback, if any
Returns
An opaque change token registration. When it is dropped, the callback function is unregistered.