diff options
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 20 |
1 files changed, 2 insertions, 18 deletions
| @@ -346,6 +346,7 @@ pub struct DeviceConfig { | |||
| 346 | pub model: &'static str, | 346 | pub model: &'static str, |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | #[derive(Default)] | ||
| 349 | pub struct DeviceBuffersOwned { | 350 | pub struct DeviceBuffersOwned { |
| 350 | pub publish: Vec<u8, 2048>, | 351 | pub publish: Vec<u8, 2048>, |
| 351 | pub subscribe: Vec<u8, 128>, | 352 | pub subscribe: Vec<u8, 128>, |
| @@ -357,21 +358,6 @@ pub struct DeviceBuffersOwned { | |||
| 357 | pub attributes_topic: String<128>, | 358 | pub attributes_topic: String<128>, |
| 358 | } | 359 | } |
| 359 | 360 | ||
| 360 | impl Default for DeviceBuffersOwned { | ||
| 361 | fn default() -> Self { | ||
| 362 | Self { | ||
| 363 | publish: Default::default(), | ||
| 364 | subscribe: Default::default(), | ||
| 365 | discovery: Default::default(), | ||
| 366 | availability_topic: Default::default(), | ||
| 367 | discovery_topic: Default::default(), | ||
| 368 | state_topic: Default::default(), | ||
| 369 | command_topic: Default::default(), | ||
| 370 | attributes_topic: Default::default(), | ||
| 371 | } | ||
| 372 | } | ||
| 373 | } | ||
| 374 | |||
| 375 | impl DeviceBuffersOwned { | 361 | impl DeviceBuffersOwned { |
| 376 | pub fn as_buffers_mut(&mut self) -> DeviceBuffers<'_> { | 362 | pub fn as_buffers_mut(&mut self) -> DeviceBuffers<'_> { |
| 377 | DeviceBuffers { | 363 | DeviceBuffers { |
| @@ -1093,10 +1079,8 @@ fn generate_entity_discovery( | |||
| 1093 | /// | 1079 | /// |
| 1094 | /// ```no_run | 1080 | /// ```no_run |
| 1095 | /// # use embassy_ha::{Device, Transport}; | 1081 | /// # use embassy_ha::{Device, Transport}; |
| 1096 | /// # async fn example(mut device: Device<'_>, create_transport: impl Fn() -> impl Transport) { | 1082 | /// # async fn example(mut device: Device<'_>, mut transport: impl Transport) { |
| 1097 | /// loop { | 1083 | /// loop { |
| 1098 | /// let mut transport = create_transport(); | ||
| 1099 | /// | ||
| 1100 | /// match embassy_ha::run(&mut device, &mut transport).await { | 1084 | /// match embassy_ha::run(&mut device, &mut transport).await { |
| 1101 | /// Ok(()) => { | 1085 | /// Ok(()) => { |
| 1102 | /// // Normal exit (this shouldn't happen in practice) | 1086 | /// // Normal exit (this shouldn't happen in practice) |
