pub struct ReflexLoop { /* private fields */ }Expand description
A reflex loop manager that evaluates rules against sensor readings.
Implementations§
Source§impl ReflexLoop
impl ReflexLoop
Sourcepub const DEFAULT_MAX_READING_AGE_SECS: f64 = 5.0
pub const DEFAULT_MAX_READING_AGE_SECS: f64 = 5.0
Default freshness bound for sensor readings, in seconds.
A rule never fires from a reading older than this: actuation must follow observation, and a cached/stuck snapshot must not actuate.
Sourcepub const fn with_max_reading_age(self, secs: f64) -> Self
pub const fn with_max_reading_age(self, secs: f64) -> Self
Override the reading freshness bound.
secs <= 0.0 disables the freshness check — tests and offline
benchmarks only; production must keep a positive bound.
Sourcepub fn add_rule(&mut self, rule: ReflexRule)
pub fn add_rule(&mut self, rule: ReflexRule)
Add a reflex rule.
Sourcepub fn evaluate(&mut self, readings: &[SensorReading]) -> Vec<ActuatorCommand>
pub fn evaluate(&mut self, readings: &[SensorReading]) -> Vec<ActuatorCommand>
Evaluate all rules against a set of sensor readings. Returns commands to execute.
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Number of rules.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReflexLoop
impl RefUnwindSafe for ReflexLoop
impl Send for ReflexLoop
impl Sync for ReflexLoop
impl Unpin for ReflexLoop
impl UnsafeUnpin for ReflexLoop
impl UnwindSafe for ReflexLoop
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