pub struct SmPool<S> { /* private fields */ }Expand description
A storage-generic pool of state machines.
Arrays, mutable slices, and allocation-backed containers can all be used as storage. Dispatch is supplied as a closure because each generated sml.rs machine has its own concrete event and error types.
Implementations§
Source§impl<S> SmPool<S>
impl<S> SmPool<S>
Sourcepub fn storage_mut(&mut self) -> &mut S
pub fn storage_mut(&mut self) -> &mut S
Returns the underlying storage mutably.
Sourcepub fn reset<M, F>(&mut self, initialize: F)
pub fn reset<M, F>(&mut self, initialize: F)
Replaces every machine using a caller-provided initializer.
Sourcepub fn process_indexed<M, E, R, F>(
&mut self,
index: usize,
event: E,
dispatch: F,
) -> Option<R>
pub fn process_indexed<M, E, R, F>( &mut self, index: usize, event: E, dispatch: F, ) -> Option<R>
Dispatches one event to one machine.
Sourcepub fn process_indexed_batch<M, E, I, F>(
&mut self,
indices: I,
event: E,
dispatch: F,
) -> usize
pub fn process_indexed_batch<M, E, I, F>( &mut self, indices: I, event: E, dispatch: F, ) -> usize
Dispatches the same clonable event to a batch of machine indices.
Returns the number of valid indices that were processed.
Sourcepub fn process_event_batch<M, E, I, F>(
&mut self,
events: I,
dispatch: F,
) -> usize
pub fn process_event_batch<M, E, I, F>( &mut self, events: I, dispatch: F, ) -> usize
Dispatches a batch of indexed events.
Returns the number of valid indices that were processed.
Auto Trait Implementations§
impl<S> Freeze for SmPool<S>where
S: Freeze,
impl<S> RefUnwindSafe for SmPool<S>where
S: RefUnwindSafe,
impl<S> Send for SmPool<S>where
S: Send,
impl<S> Sync for SmPool<S>where
S: Sync,
impl<S> Unpin for SmPool<S>where
S: Unpin,
impl<S> UnsafeUnpin for SmPool<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for SmPool<S>where
S: UnwindSafe,
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