pub trait UseStateMachine<G>: HasStateMachine<G>{
Show 18 methods
// Provided methods
fn add_source<'life0, 'async_trait, S>(
&'life0 self,
tag: G,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn add_source_ex<'life0, 'async_trait, S>(
&'life0 self,
tag: G,
chan_capacity: usize,
init_value: S,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn del_source<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn has_source<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn num_of_subscriptions<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn source_value<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = S> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn source_value_ex<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = Value<S>> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn change<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
s: S,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn wait_change<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
s: S,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn modify<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
func: impl 'async_trait + Fn(S) -> S + Send + Sync + 'static,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn wait_modify<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
func: impl 'async_trait + Fn(S) -> S + Send + Sync + 'static,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn touch<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn has_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_value<'life0, 'life1, 'async_trait, T>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
where T: 'static + Clone + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn handle_value_ex<'life0, 'life1, 'async_trait, T>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = Value<T>> + Send + 'async_trait>>
where T: 'static + Clone + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn reader<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = Reader<S>> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn reader_ex<'life0, 'life1, 'async_trait, S, T>(
&'life0 self,
tag: &'life1 G,
func: impl 'async_trait + Fn(S) -> Pin<Box<dyn Future<Output = T> + Send>> + Send + Sync + 'static,
) -> Pin<Box<dyn Future<Output = ReaderEx<S, T>> + Send + 'async_trait>>
where S: 'static + Clone + Default + PartialEq + Send + 'async_trait,
T: 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn unsubscribe<'life0, 'life1, 'async_trait, T>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where T: 'static + Clone + PartialEq + Send + Sync + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Some convenient methods to use state machine. The trait is auto implemented for types implemented HasStateMachine.
Provided Methods§
Sourcefn add_source<'life0, 'async_trait, S>(
&'life0 self,
tag: G,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
fn add_source<'life0, 'async_trait, S>( &'life0 self, tag: G, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
Add source to state machine, the source is created by default.
Sourcefn add_source_ex<'life0, 'async_trait, S>(
&'life0 self,
tag: G,
chan_capacity: usize,
init_value: S,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
fn add_source_ex<'life0, 'async_trait, S>( &'life0 self, tag: G, chan_capacity: usize, init_value: S, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
Add source to state machine.
Sourcefn del_source<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn del_source<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete source from state machine.
Sourcefn has_source<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_source<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
If source of tag exists in state machine.
Sourcefn num_of_subscriptions<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
fn num_of_subscriptions<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
Num of subscriptions.
Sourcefn source_value<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = S> + Send + 'async_trait>>
fn source_value<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, ) -> Pin<Box<dyn Future<Output = S> + Send + 'async_trait>>
Get current value of source.
Sourcefn source_value_ex<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = Value<S>> + Send + 'async_trait>>
fn source_value_ex<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, ) -> Pin<Box<dyn Future<Output = Value<S>> + Send + 'async_trait>>
Get current value of source with timestamp.
Sourcefn change<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
s: S,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
fn change<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, s: S, ) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
Change state of source.
Sourcefn wait_change<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
s: S,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
fn wait_change<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, s: S, ) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
Change state of source, and wait responders to finish actions upon the change event.
Sourcefn modify<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
func: impl 'async_trait + Fn(S) -> S + Send + Sync + 'static,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
fn modify<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, func: impl 'async_trait + Fn(S) -> S + Send + Sync + 'static, ) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
Change state of source by modifying it with a func.
Sourcefn wait_modify<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
func: impl 'async_trait + Fn(S) -> S + Send + Sync + 'static,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
fn wait_modify<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, func: impl 'async_trait + Fn(S) -> S + Send + Sync + 'static, ) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
Change state of source by modifying it with a func, and wait responders to finish actions upon the change event.
Sourcefn touch<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
fn touch<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, ) -> Pin<Box<dyn Future<Output = Result<(), SourceChangeError>> + Send + 'async_trait>>
Create a change event without changing state of source really.
Sourcefn has_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
If handle of tag exists in state machine.
Sourcefn handle_value<'life0, 'life1, 'async_trait, T>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
fn handle_value<'life0, 'life1, 'async_trait, T>( &'life0 self, tag: &'life1 G, ) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>>
Get current value of handle.
Sourcefn handle_value_ex<'life0, 'life1, 'async_trait, T>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = Value<T>> + Send + 'async_trait>>
fn handle_value_ex<'life0, 'life1, 'async_trait, T>( &'life0 self, tag: &'life1 G, ) -> Pin<Box<dyn Future<Output = Value<T>> + Send + 'async_trait>>
Get current value of handle with timestamp.
Sourcefn reader<'life0, 'life1, 'async_trait, S>(
&'life0 self,
tag: &'life1 G,
) -> Pin<Box<dyn Future<Output = Reader<S>> + Send + 'async_trait>>
fn reader<'life0, 'life1, 'async_trait, S>( &'life0 self, tag: &'life1 G, ) -> Pin<Box<dyn Future<Output = Reader<S>> + Send + 'async_trait>>
Get reader of source, can be subscribed by responders.
Sourcefn reader_ex<'life0, 'life1, 'async_trait, S, T>(
&'life0 self,
tag: &'life1 G,
func: impl 'async_trait + Fn(S) -> Pin<Box<dyn Future<Output = T> + Send>> + Send + Sync + 'static,
) -> Pin<Box<dyn Future<Output = ReaderEx<S, T>> + Send + 'async_trait>>
fn reader_ex<'life0, 'life1, 'async_trait, S, T>( &'life0 self, tag: &'life1 G, func: impl 'async_trait + Fn(S) -> Pin<Box<dyn Future<Output = T> + Send>> + Send + Sync + 'static, ) -> Pin<Box<dyn Future<Output = ReaderEx<S, T>> + Send + 'async_trait>>
Get reader of source, can be subscribed by responders.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".