Skip to main content

ReactiveNode

Trait ReactiveNode 

Source
pub trait ReactiveNode<Change, Context, Action>: Send + Sync
where 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§

Source

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

Source

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

Source

fn id(&self) -> NodeId

Get the node’s unique identifier

Implementors§

Source§

impl<Change, Context, Action, WatchFn, ReactFn> ReactiveNode<Change, Context, Action> for CustomReactiveNode<Change, Context, Action, WatchFn, ReactFn>
where Change: Send + Sync + 'static, Context: Send + Sync + 'static, Action: ActionType + Send + Sync + 'static + Debug, WatchFn: Fn() -> Result<Box<dyn Stream<Item = Change> + Send + Unpin>, FloxideError> + Send + Sync + 'static, ReactFn: Fn(Change, &mut Context) -> Result<Action, FloxideError> + Send + Sync + 'static,

Source§

impl<Context, Action> ReactiveNode<FileChange, Context, Action> for FileWatcherNode<Context, Action>
where Context: Send + Sync + 'static, Action: ActionType + Send + Sync + 'static + Debug,