#[non_exhaustive]pub enum SingleReading {
Humidity(f32),
Temperature(f32),
CO2(u16),
Unknown(u8, u16),
}
Expand description
A single sensor reading.
§Example
let decoded = zg_co2::decode([0x50, 0x04, 0x57, 0xab, 0x0d])?;
if let SingleReading::CO2(co2) = decoded {
println!("CO₂: {} ppm", co2);
}
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Humidity(f32)
Relative humidity
Temperature(f32)
Temperature in °C
CO2(u16)
CO₂ concentration, measured in ppm
Unknown(u8, u16)
An unknown reading
Trait Implementations§
Source§impl Clone for SingleReading
impl Clone for SingleReading
Source§fn clone(&self) -> SingleReading
fn clone(&self) -> SingleReading
Returns a copy 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 SingleReading
impl Debug for SingleReading
Source§impl PartialEq for SingleReading
impl PartialEq for SingleReading
Source§impl PartialOrd for SingleReading
impl PartialOrd for SingleReading
impl StructuralPartialEq for SingleReading
Auto Trait Implementations§
impl Freeze for SingleReading
impl RefUnwindSafe for SingleReading
impl Send for SingleReading
impl Sync for SingleReading
impl Unpin for SingleReading
impl UnwindSafe for SingleReading
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)