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§

source

fn changed(&self) -> bool

Gets a value that indicates if a change has occurred.

source

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 invoke
  • state - The optional state provided to the callback, if any
Returns

An opaque change token registration. When it is dropped, the callback function is unregistered.

Provided Methods§

source

fn must_poll(&self) -> bool

Indicates if this token will proactively raise callbacks.

Remarks

If false, the token consumer should expect for that any callback specified in register will be invoked when a change occurs. If false, the token consumer must poll changed to detect changes.

Trait Implementations§

source§

impl ChangeToken for Box<dyn ChangeToken>

source§

fn changed(&self) -> bool

Gets a value that indicates if a change has occurred.
source§

fn must_poll(&self) -> bool

Indicates if this token will proactively raise callbacks. Read more
source§

fn register( &self, callback: Callback, state: Option<Arc<dyn Any>> ) -> Registration

Registers for a callback that will be invoked when the token has changed. Read more

Implementations on Foreign Types§

source§

impl ChangeToken for Box<dyn ChangeToken>

source§

fn changed(&self) -> bool

source§

fn must_poll(&self) -> bool

source§

fn register( &self, callback: Callback, state: Option<Arc<dyn Any>> ) -> Registration

Implementors§