fix accesability
This commit is contained in:
parent
2d2b0026ad
commit
f0b3431145
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -245,8 +245,8 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mqttclient"
|
name = "mqtt-client"
|
||||||
version = "0.1.0"
|
version = "1.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam",
|
"crossbeam",
|
||||||
"rumqttc",
|
"rumqttc",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mqttclient"
|
name = "mqtt-client"
|
||||||
version = "0.1.0"
|
version = "1.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
10
src/lib.rs
10
src/lib.rs
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
mod mqtt_client {
|
pub mod mqtt_client {
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
@ -8,12 +8,12 @@ mod mqtt_client {
|
|||||||
|
|
||||||
pub trait MqttTool {
|
pub trait MqttTool {
|
||||||
fn new(client: Client, tx: Sender<MqttMessage>) -> Self;
|
fn new(client: Client, tx: Sender<MqttMessage>) -> Self;
|
||||||
fn rx(&self, messaage: MqttMessage);
|
fn rx(&mut self, messaage: MqttMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MqttMessage {
|
pub struct MqttMessage {
|
||||||
topic: String,
|
pub topic: String,
|
||||||
payload: String
|
pub payload: String
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run<T: MqttTool>(host: String, port: u16, client: String, user: String, pass: String) {
|
pub fn run<T: MqttTool>(host: String, port: u16, client: String, user: String, pass: String) {
|
||||||
@ -69,7 +69,7 @@ mod mqtt_client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(self) fn handeler<T: MqttTool>(mut connection: Connection, tool: T) {
|
pub(self) fn handeler<T: MqttTool>(mut connection: Connection, mut tool: T) {
|
||||||
for (_i, notification) in connection.iter().enumerate() {
|
for (_i, notification) in connection.iter().enumerate() {
|
||||||
let mut delay: bool = false;
|
let mut delay: bool = false;
|
||||||
match notification {
|
match notification {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user