pub trait AsyncInput {
type Input: Bag;
// Required method
fn handle(
&mut self,
config: &Config,
t_from: f64,
t_until: f64,
input: &mut Self::Input,
) -> impl Future<Output = f64>;
}
Expand description
Interface for handling input events in an asynchronous DEVS simulation.
Unlike other traits, this trait must be implemented by the user, as it is not generated by macros. It allows the model to handle input events asynchronously, waiting for external events without blocking the simulation.
Required Associated Types§
Required Methods§
Sourcefn handle(
&mut self,
config: &Config,
t_from: f64,
t_until: f64,
input: &mut Self::Input,
) -> impl Future<Output = f64>
fn handle( &mut self, config: &Config, t_from: f64, t_until: f64, input: &mut Self::Input, ) -> impl Future<Output = f64>
Handles input events asynchronously.
It receives the time interval [t_from, t_until]
and a mutable reference to the input event bag.
It returns the time of the next event, which is usually the time of the next state transition.
If an external event occurs, it should inject the event to the input and return the time at which the event happened.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.