pub struct EventProcessor<Event, Context, Action, F>where
Event: Send + 'static,
Context: Send + Sync + 'static,
Action: ActionType + Send + Sync + 'static + Default,
F: Fn(Event, &mut Context) -> Result<Action, FloxideError> + Send + Sync + 'static,{ /* private fields */ }Expand description
An event processor that applies a function to each event
Implementations§
Source§impl<Event, Context, Action, F> EventProcessor<Event, Context, Action, F>where
Event: Send + 'static,
Context: Send + Sync + 'static,
Action: ActionType + Send + Sync + 'static + Default,
F: Fn(Event, &mut Context) -> Result<Action, FloxideError> + Send + Sync + 'static,
impl<Event, Context, Action, F> EventProcessor<Event, Context, Action, F>where
Event: Send + 'static,
Context: Send + Sync + 'static,
Action: ActionType + Send + Sync + 'static + Default,
F: Fn(Event, &mut Context) -> Result<Action, FloxideError> + Send + Sync + 'static,
Trait Implementations§
Source§impl<Event, Context, Action, F> EventDrivenNode<Event, Context, Action> for EventProcessor<Event, Context, Action, F>where
Event: Send + 'static,
Context: Send + Sync + 'static,
Action: ActionType + Send + Sync + 'static + Default,
F: Fn(Event, &mut Context) -> Result<Action, FloxideError> + Send + Sync + 'static,
impl<Event, Context, Action, F> EventDrivenNode<Event, Context, Action> for EventProcessor<Event, Context, Action, F>where
Event: Send + 'static,
Context: Send + Sync + 'static,
Action: ActionType + Send + Sync + 'static + Default,
F: Fn(Event, &mut Context) -> Result<Action, FloxideError> + Send + Sync + 'static,
Source§fn wait_for_event<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Event, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait_for_event<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Event, FloxideError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Wait for an external event to occur
Source§fn process_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: Event,
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 process_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event: Event,
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,
Process the received event and update context
Auto Trait Implementations§
impl<Event, Context, Action, F> Freeze for EventProcessor<Event, Context, Action, F>where
F: Freeze,
impl<Event, Context, Action, F> !RefUnwindSafe for EventProcessor<Event, Context, Action, F>
impl<Event, Context, Action, F> Send for EventProcessor<Event, Context, Action, F>
impl<Event, Context, Action, F> Sync for EventProcessor<Event, Context, Action, F>
impl<Event, Context, Action, F> Unpin for EventProcessor<Event, Context, Action, F>
impl<Event, Context, Action, F> UnsafeUnpin for EventProcessor<Event, Context, Action, F>where
F: UnsafeUnpin,
impl<Event, Context, Action, F> !UnwindSafe for EventProcessor<Event, Context, Action, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more