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]]
|
||||
name = "mqttclient"
|
||||
version = "0.1.0"
|
||||
name = "mqtt-client"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"crossbeam",
|
||||
"rumqttc",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mqttclient"
|
||||
version = "0.1.0"
|
||||
name = "mqtt-client"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
|
||||
[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::thread;
|
||||
|
||||
@ -8,12 +8,12 @@ mod mqtt_client {
|
||||
|
||||
pub trait MqttTool {
|
||||
fn new(client: Client, tx: Sender<MqttMessage>) -> Self;
|
||||
fn rx(&self, messaage: MqttMessage);
|
||||
fn rx(&mut self, messaage: MqttMessage);
|
||||
}
|
||||
|
||||
pub struct MqttMessage {
|
||||
topic: String,
|
||||
payload: String
|
||||
pub topic: String,
|
||||
pub payload: 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() {
|
||||
let mut delay: bool = false;
|
||||
match notification {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user