pub struct ReadingValidator { /* private fields */ }Expand description
Validator for sensor readings.
Implementations§
Source§impl ReadingValidator
impl ReadingValidator
Sourcepub fn new(config: ValidatorConfig) -> Self
pub fn new(config: ValidatorConfig) -> Self
Create a new validator with the given configuration.
Sourcepub fn config(&self) -> &ValidatorConfig
pub fn config(&self) -> &ValidatorConfig
Get the configuration.
Sourcepub fn validate(&self, reading: &CurrentReading) -> ValidationResult
pub fn validate(&self, reading: &CurrentReading) -> ValidationResult
Validate a sensor reading.
Sourcepub fn is_co2_valid(&self, co2: u16) -> bool
pub fn is_co2_valid(&self, co2: u16) -> bool
Quick check if a CO2 value is within expected range.
Sourcepub fn is_temperature_valid(&self, temp: f32) -> bool
pub fn is_temperature_valid(&self, temp: f32) -> bool
Quick check if a temperature value is within expected range.
Trait Implementations§
Source§impl Clone for ReadingValidator
impl Clone for ReadingValidator
Source§fn clone(&self) -> ReadingValidator
fn clone(&self) -> ReadingValidator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReadingValidator
impl Debug for ReadingValidator
Source§impl Default for ReadingValidator
impl Default for ReadingValidator
Source§fn default() -> ReadingValidator
fn default() -> ReadingValidator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ReadingValidator
impl RefUnwindSafe for ReadingValidator
impl Send for ReadingValidator
impl Sync for ReadingValidator
impl Unpin for ReadingValidator
impl UnwindSafe for ReadingValidator
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