pub struct Replay { /* private fields */ }Expand description
A fake sensor that replays a fixed sequence of readings.
Where a SimSensor generates a signal, a Replay plays back exact values in
order, which is what a deterministic test or a scripted demo wants: spell out the
readings that tell the story, and the sensor yields them one per
read. A one-shot replay reports [Error::Closed] once the
sequence is exhausted; a repeating one loops forever.
§Examples
use pamoja_core::Sensor;
use pamoja_sim::Replay;
let mut gauge = Replay::new(vec![1.0, 1.2, 1.9]);
assert_eq!(gauge.read().await?, 1.0);
assert_eq!(gauge.read().await?, 1.2);Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Replay
impl RefUnwindSafe for Replay
impl Send for Replay
impl Sync for Replay
impl Unpin for Replay
impl UnsafeUnpin for Replay
impl UnwindSafe for Replay
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