[−][src]Struct mosquitto_client_wrapper::Callbacks
Handling mosquitto callbacks. This will pass a mutable reference to the contained data to the callbacks.
Fields
data: T
Implementations
impl<'a, T> Callbacks<'a, T>
[src]
pub fn new(mosq: &Mosquitto, data: T) -> Callbacks<'_, T>
[src]
create a new callback handler with data. Initialize with an existing Mosquitto reference.
pub fn mosq(&self) -> &Mosquitto
[src]
a reference to the Mosquitto instance
pub fn on_message<C: Fn(&mut T, MosqMessage) + 'a>(&mut self, callback: C)
[src]
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]
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]
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]
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]
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]
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]
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
Trait Implementations
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for Callbacks<'a, T>
[src]
impl<'a, T> !Send for Callbacks<'a, T>
[src]
impl<'a, T> !Sync for Callbacks<'a, T>
[src]
impl<'a, T> Unpin for Callbacks<'a, T> where
T: Unpin,
[src]
T: Unpin,
impl<'a, T> !UnwindSafe for Callbacks<'a, T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,