mirror of
https://codeberg.org/icewind/tasmota-mqtt-client.git
synced 2026-06-03 18:24:09 +02:00
clippy fixes, msrv
This commit is contained in:
parent
054b8e277c
commit
3e32333d26
3 changed files with 7 additions and 8 deletions
|
|
@ -3,7 +3,7 @@ name = "tasmota-mqtt-client"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
rust-version = "1.64.0"
|
||||
rust-version = "1.70.0"
|
||||
|
||||
[dependencies]
|
||||
rumqttc = { version = "0.23.0", features = ["use-rustls"] }
|
||||
|
|
|
|||
12
src/lib.rs
12
src/lib.rs
|
|
@ -64,7 +64,7 @@ impl TasmotaClient {
|
|||
let _ = tx.send(DeviceUpdate::Added(device.into()));
|
||||
}
|
||||
"Offline" => {
|
||||
edit_devices.lock().unwrap().remove(device.into());
|
||||
edit_devices.lock().unwrap().remove(device);
|
||||
let _ = tx.send(DeviceUpdate::Removed(device.into()));
|
||||
}
|
||||
_ => {}
|
||||
|
|
@ -103,16 +103,14 @@ impl TasmotaClient {
|
|||
}
|
||||
|
||||
/// Subscribe to device discovery, receiving a [`DeviceUpdate`] whenever a device comes online or goes offline
|
||||
///
|
||||
/// This will include an update for any device that is known at the time of calling
|
||||
pub fn devices(&self) -> impl Stream<Item = DeviceUpdate> {
|
||||
let current = self.current_devices();
|
||||
let rx = self.device_update.subscribe();
|
||||
|
||||
tokio_stream::iter(
|
||||
current
|
||||
.into_iter()
|
||||
.map(|device| DeviceUpdate::Added(device)),
|
||||
)
|
||||
.chain(BroadcastStream::new(rx).filter_map(Result::ok))
|
||||
tokio_stream::iter(current.into_iter().map(DeviceUpdate::Added))
|
||||
.chain(BroadcastStream::new(rx).filter_map(Result::ok))
|
||||
}
|
||||
|
||||
/// Send a command that expect a single reply message
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use tracing::{debug, error};
|
|||
|
||||
pub struct MqttHelper {
|
||||
client: AsyncClient,
|
||||
#[allow(clippy::type_complexity)]
|
||||
listeners: Arc<Mutex<Vec<(String, Sender<Publish>)>>>,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue