From 4687daaf620e0d0951e4657d052eaa713d18fa71 Mon Sep 17 00:00:00 2001 From: diogo464 Date: Tue, 9 Dec 2025 22:58:31 +0000 Subject: small visibility fixes --- src/entity.rs | 2 +- src/lib.rs | 38 +++++++++++++++++++++++--------------- src/log.rs | 2 ++ 3 files changed, 26 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/entity.rs b/src/entity.rs index ef2b9ad..e7aa895 100644 --- a/src/entity.rs +++ b/src/entity.rs @@ -18,7 +18,7 @@ impl EntityCommonConfig { } #[derive(Default)] -pub struct EntityConfig { +pub(crate) struct EntityConfig { pub id: &'static str, pub name: Option<&'static str>, pub domain: &'static str, diff --git a/src/lib.rs b/src/lib.rs index 50c6308..234d0e9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ //! Home Assistant MQTT device library for embassy. //! //! To create a device use the [`new`] function. +//! //! After the device is created you should create one or more entities using functions such as //! [`create_button`]/[`create_sensor`]/... //! @@ -30,8 +31,9 @@ use serde::Serialize; mod mqtt; -pub mod log; -pub use log::Format; +mod log; +#[allow(unused)] +use log::Format; pub mod constants; @@ -250,73 +252,79 @@ impl Default for DeviceResources { } #[derive(Debug, Default)] -pub struct ButtonStorage { +pub(crate) struct ButtonStorage { pub timestamp: Option, pub consumed: bool, } #[derive(Debug)] -pub struct SwitchCommand { +pub(crate) struct SwitchCommand { pub value: BinaryState, + #[allow(unused)] pub timestamp: embassy_time::Instant, } #[derive(Debug)] -pub struct SwitchState { +pub(crate) struct SwitchState { pub value: BinaryState, + #[allow(unused)] pub timestamp: embassy_time::Instant, } #[derive(Debug, Default)] -pub struct SwitchStorage { +pub(crate) struct SwitchStorage { pub state: Option, pub command: Option, pub publish_on_command: bool, } #[derive(Debug)] -pub struct BinarySensorState { +pub(crate) struct BinarySensorState { pub value: BinaryState, + #[allow(unused)] pub timestamp: embassy_time::Instant, } #[derive(Debug, Default)] -pub struct BinarySensorStorage { +pub(crate) struct BinarySensorStorage { pub state: Option, } #[derive(Debug)] -pub struct NumericSensorState { +pub(crate) struct NumericSensorState { pub value: f32, + #[allow(unused)] pub timestamp: embassy_time::Instant, } #[derive(Debug, Default)] -pub struct NumericSensorStorage { +pub(crate) struct NumericSensorStorage { pub state: Option, } #[derive(Debug)] -pub struct NumberState { +pub(crate) struct NumberState { pub value: f32, + #[allow(unused)] pub timestamp: embassy_time::Instant, } #[derive(Debug)] -pub struct NumberCommand { +pub(crate) struct NumberCommand { pub value: f32, + #[allow(unused)] pub timestamp: embassy_time::Instant, } #[derive(Debug, Default)] -pub struct NumberStorage { +pub(crate) struct NumberStorage { pub state: Option, pub command: Option, pub publish_on_command: bool, } #[derive(Debug)] -pub enum EntityStorage { +pub(crate) enum EntityStorage { Button(ButtonStorage), Switch(SwitchStorage), BinarySensor(BinarySensorStorage), @@ -369,7 +377,7 @@ struct EntityData { command_waker: Option, } -pub struct Entity<'a> { +pub(crate) struct Entity<'a> { pub(crate) data: &'a RefCell>, pub(crate) waker: &'a AtomicWaker, } diff --git a/src/log.rs b/src/log.rs index 5b67001..b86f522 100644 --- a/src/log.rs +++ b/src/log.rs @@ -24,6 +24,7 @@ pub use defmt::Format; // For tracing or no logging, we provide a stub Format trait +#[allow(unused)] #[cfg(not(feature = "defmt"))] pub trait Format {} @@ -113,4 +114,5 @@ macro_rules! error { } // Re-export the macros at the module level for easier use +#[allow(unused)] pub use crate::{debug, error, info, trace, warn}; -- cgit