1
0
forked from ROMEO/nexosim

Merge step_by and step_until into a unique method

Now that `step_by` returns an error anyway (it was unfaillible before),
there is no more incentive to keep it as a separate method.
The `step_until` method now accepts an `impl Deadline`, which covers
both cases (`Duration` and `MonotonicTime`).
This commit is contained in:
Serge Barral
2024-11-14 12:45:00 +01:00
parent 95aac7721c
commit b5aea810ae
10 changed files with 48 additions and 60 deletions

View File

@ -230,7 +230,7 @@ fn main() -> Result<(), SimulationError> {
);
// All data processed.
simu.step_by(Duration::from_millis(101))?;
simu.step_until(Duration::from_millis(101))?;
expect(
&mut mode,
Some(ModeId::Idle),
@ -266,7 +266,7 @@ fn main() -> Result<(), SimulationError> {
);
// Wait for short processing to finish, check results.
simu.step_by(Duration::from_millis(11))?;
simu.step_until(Duration::from_millis(11))?;
expect(
&mut mode,
Some(ModeId::Idle),
@ -279,7 +279,7 @@ fn main() -> Result<(), SimulationError> {
// Wait long enough, no state change as the long processing has been
// cancelled.
simu.step_by(Duration::from_millis(100))?;
simu.step_until(Duration::from_millis(100))?;
assert_eq!(mode.next(), None);
assert_eq!(value.next(), None);
assert_eq!(hk.next(), None);