#[non_exhaustive]#[repr(u8)]pub enum Status {
Error = 0,
Green = 1,
Yellow = 2,
Red = 3,
}Expand description
CO2 level status indicator.
This enum is marked #[non_exhaustive] to allow adding new status levels
in future versions without breaking downstream code.
§Ordering
Status values are ordered by severity: Error < Green < Yellow < Red.
This allows threshold comparisons like if status >= Status::Yellow { warn!(...) }.
§Display vs Serialization
Note: The Display trait returns human-readable labels (“Good”, “Moderate”, “High”),
while serde serialization uses the variant names (“Green”, “Yellow”, “Red”).
use aranet_types::Status;
// Display is human-readable
assert_eq!(format!("{}", Status::Green), "Good");
// Ordering works for threshold comparisons
assert!(Status::Red > Status::Yellow);
assert!(Status::Yellow > Status::Green);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.
Error = 0
Error or invalid reading.
Green = 1
CO2 level is good (green).
Yellow = 2
CO2 level is moderate (yellow).
Red = 3
CO2 level is high (red).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Status
impl<'de> Deserialize<'de> for Status
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Status, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Status, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Status
impl Ord for Status
Source§impl PartialOrd for Status
impl PartialOrd for Status
Source§impl Serialize for Status
impl Serialize for Status
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Status
impl Eq for Status
impl StructuralPartialEq for Status
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
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