pub trait ReactiveNode<Change, Context, Action>: Send + Syncwhere
Change: Send + Sync + 'static,
Context: Send + Sync + 'static,
Action: ActionType + Send + Sync + 'static + Debug,{
// Required methods
fn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Change> + Send + Unpin>, FloxideError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn react_to_change<'life0, 'life1, 'async_trait>(
&'life0 self,
change: Change,
ctx: &'life1 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn id(&self) -> NodeId;
}Expand description
Trait for nodes that react to changes in external data sources
Required Methods§
Sourcefn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Change> + Send + Unpin>, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Change> + Send + Unpin>, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set up a stream of changes to watch
Sourcefn react_to_change<'life0, 'life1, 'async_trait>(
&'life0 self,
change: Change,
ctx: &'life1 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn react_to_change<'life0, 'life1, 'async_trait>(
&'life0 self,
change: Change,
ctx: &'life1 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Action, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
React to a detected change