Struct mosquitto_client::Callbacks [−][src]
pub struct Callbacks<'a, T> { pub data: T, // some fields omitted }
Handling mosquitto callbacks. This will pass a mutable reference to the contained data to the callbacks.
Fields
data: T
Methods
impl<'a, T> Callbacks<'a, T>
[src]
impl<'a, T> Callbacks<'a, T>
pub fn new(mosq: &Mosquitto, data: T) -> Callbacks<T>
[src]
pub fn new(mosq: &Mosquitto, data: T) -> Callbacks<T>
create a new callback handler with data. Initialize with an existing Mosquitto reference.
pub fn mosq(&self) -> &Mosquitto
[src]
pub fn mosq(&self) -> &Mosquitto
a reference to the Mosquitto instance
pub fn on_message<C: Fn(&mut T, MosqMessage) + 'a>(&mut self, callback: C)
[src]
pub fn on_message<C: Fn(&mut T, MosqMessage) + 'a>(&mut self, callback: C)
provide a closure which will be called when messages arrive. You are passed a mutable reference to data and the message
pub fn on_connect<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
[src]
pub fn on_connect<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
provide a closure which is called when connection happens. You are passed a mutable reference to data and the status.
pub fn on_publish<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
[src]
pub fn on_publish<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
provide a closure which is called after publishing a message. You are passed a mutable reference to data and the message id.
pub fn on_subscribe<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
[src]
pub fn on_subscribe<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
provide a closure which is called after subscribing. You are passed a mutable reference to data and the subscription id.
pub fn on_unsubscribe<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
[src]
pub fn on_unsubscribe<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
provide a closure which is called after unsubscribing from a topic You are passed a mutable reference to data and the subscription id.
pub fn on_disconnect<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
[src]
pub fn on_disconnect<C: Fn(&mut T, i32) + 'a>(&mut self, callback: C)
provide a closure which is called when client disconnects from broker. You are passed a mutable reference to data and ....
pub fn on_log<C: Fn(&mut T, u32, &str) + 'a>(&mut self, callback: C)
[src]
pub fn on_log<C: Fn(&mut T, u32, &str) + 'a>(&mut self, callback: C)
provide a closure which is called for each log message You are passed a mutable reference to data, a logging level, and the text of the log message