Skip to main content

Automaton

Trait Automaton 

Source
pub trait Automaton:
    Send
    + Sync
    + Debug {
    type Internal: Clone + Send + Sync + 'static;
    type Action: Debug + Clone + Send + Sync + Default + 'static;

    // Required methods
    fn step(
        &self,
        internal: &mut Self::Internal,
        current: &ParamValue,
        time: Time,
        action: &Self::Action,
    ) -> ParamValue;
    fn initial_internal(&self) -> Self::Internal;
    fn name(&self) -> &str;

    // Provided method
    fn reset(&self) -> Self::Internal { ... }
}
Expand description

Core trait for automatons — stateful signal generators that advance per step.

Required Associated Types§

Source

type Internal: Clone + Send + Sync + 'static

The automaton’s internal state, carried across step invocations.

Source

type Action: Debug + Clone + Send + Sync + Default + 'static

An optional action type driving state transitions on each step.

Required Methods§

Source

fn step( &self, internal: &mut Self::Internal, current: &ParamValue, time: Time, action: &Self::Action, ) -> ParamValue

Advances the automaton by one step, producing a new output value.

internal holds mutable state, current is the last output value, time is the elapsed time in seconds, and action is an optional trigger.

Source

fn initial_internal(&self) -> Self::Internal

Returns the automaton’s initial internal state (at time zero).

Source

fn name(&self) -> &str

Returns the human-readable name of this automaton.

Provided Methods§

Source

fn reset(&self) -> Self::Internal

Resets the automaton to its initial internal state.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§