diff --git a/Cargo.lock b/Cargo.lock index 073b626..13cbb44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -245,8 +245,8 @@ dependencies = [ ] [[package]] -name = "mqttclient" -version = "0.1.0" +name = "mqtt-client" +version = "1.0.0" dependencies = [ "crossbeam", "rumqttc", diff --git a/Cargo.toml b/Cargo.toml index a52e299..ac17df2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "mqttclient" -version = "0.1.0" +name = "mqtt-client" +version = "1.0.0" edition = "2021" [dependencies] diff --git a/src/lib.rs b/src/lib.rs index a0b6930..9aa24bb 100644 --- a/src/lib.rs +++ b/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) -> 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(host: String, port: u16, client: String, user: String, pass: String) { @@ -69,7 +69,7 @@ mod mqtt_client { } } - pub(self) fn handeler(mut connection: Connection, tool: T) { + pub(self) fn handeler(mut connection: Connection, mut tool: T) { for (_i, notification) in connection.iter().enumerate() { let mut delay: bool = false; match notification {