pub struct MooreMachineRs<S, I, O> { /* private fields */ }Expand description
A Moore machine over Rust values: output depends only on state.
Each transition takes a state and input and returns the next state. The output function maps states to outputs.
Implementations§
Source§impl<S: 'static, I: 'static, O: 'static> MooreMachineRs<S, I, O>
impl<S: 'static, I: 'static, O: 'static> MooreMachineRs<S, I, O>
Sourcepub fn new(
state: S,
transition: impl Fn(&S, I) -> S + 'static,
output: impl Fn(&S) -> O + 'static,
) -> Self
pub fn new( state: S, transition: impl Fn(&S, I) -> S + 'static, output: impl Fn(&S) -> O + 'static, ) -> Self
Create a new Moore machine.
Sourcepub fn read_output(&self) -> O
pub fn read_output(&self) -> O
Read the current output (depends only on state).
Auto Trait Implementations§
impl<S, I, O> Freeze for MooreMachineRs<S, I, O>where
S: Freeze,
impl<S, I, O> !RefUnwindSafe for MooreMachineRs<S, I, O>
impl<S, I, O> !Send for MooreMachineRs<S, I, O>
impl<S, I, O> !Sync for MooreMachineRs<S, I, O>
impl<S, I, O> Unpin for MooreMachineRs<S, I, O>where
S: Unpin,
impl<S, I, O> UnsafeUnpin for MooreMachineRs<S, I, O>where
S: UnsafeUnpin,
impl<S, I, O> !UnwindSafe for MooreMachineRs<S, I, O>
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