Skip to main content

ControlApplier

Trait ControlApplier 

Source
pub trait ControlApplier<T>:
    Send
    + Sync
    + 'static
where T: Clone + Send + Sync + 'static,
{ // Required method fn apply( &self, value: T, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + '_>>; }
Expand description

Async callback registered on a Control. Each call attempts to apply a new value and returns Ok(()) once the new value is in effect for this subscriber, or Err(msg) if the apply could not be completed.

Implementors should keep their own state consistent with either the old or the new value; partial / corrupted apply states are outside the protocol.

Required Methods§

Source

fn apply( &self, value: T, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + '_>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T, F> ControlApplier<T> for SyncApplier<T, F>
where T: Clone + Send + Sync + 'static, F: Fn(T) -> Result<(), String> + Send + Sync + 'static,