pub struct ModeMachine { /* private fields */ }Expand description
Hysteresis state machine (enter after 10 s, leave after 30 s, per mode).
Implementations§
Source§impl ModeMachine
impl ModeMachine
pub fn new() -> Self
Sourcepub fn current(&self) -> Mode
pub fn current(&self) -> Mode
The mode to show: the pinned one if pinned, else the latched situation.
Sourcepub fn underlying(&self) -> Mode
pub fn underlying(&self) -> Mode
The latched situation, ignoring a pin.
pub fn is_pinned(&self) -> bool
Sourcepub fn update(&mut self, now_ms: u64, sig: &ModeSignals) -> Mode
pub fn update(&mut self, now_ms: u64, sig: &ModeSignals) -> Mode
Feeds one sample and returns the mode to show. The first sample is adopted as-is; afterwards each
mode enters once its condition has held ≥ 10 s and leaves once it has been false ≥ 30 s. If the clock
goes backwards (replay restart, clock change), timers restart from now_ms.
Trait Implementations§
Source§impl Clone for ModeMachine
impl Clone for ModeMachine
Source§impl Debug for ModeMachine
impl Debug for ModeMachine
Source§impl Default for ModeMachine
impl Default for ModeMachine
Source§impl PartialEq for ModeMachine
impl PartialEq for ModeMachine
impl StructuralPartialEq for ModeMachine
Auto Trait Implementations§
impl Forget for ModeMachine
impl Freeze for ModeMachine
impl Move for ModeMachine
impl RefUnwindSafe for ModeMachine
impl Send for ModeMachine
impl Sync for ModeMachine
impl Unpin for ModeMachine
impl UnsafeUnpin for ModeMachine
impl UnwindSafe for ModeMachine
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