pub struct MqttTopicSubscriber<MessageType, PayloadType, SerializerType> { /* private fields */ }
Expand description
Structured MQTT subscriber with automatic topic parameter extraction.
Created via #[mqtt_topic]
macro. Converts raw MQTT messages into structured types.
Implementations§
Source§impl<MessageType, PayloadType, SerializerType> MqttTopicSubscriber<MessageType, PayloadType, SerializerType>where
MessageType: FromMqttMessage<PayloadType, <SerializerType as MessageSerializer<PayloadType>>::DeserializeError>,
PayloadType: Send + Sync + 'static,
SerializerType: Default + Clone + Send + Sync + MessageSerializer<PayloadType>,
impl<MessageType, PayloadType, SerializerType> MqttTopicSubscriber<MessageType, PayloadType, SerializerType>where
MessageType: FromMqttMessage<PayloadType, <SerializerType as MessageSerializer<PayloadType>>::DeserializeError>,
PayloadType: Send + Sync + 'static,
SerializerType: Default + Clone + Send + Sync + MessageSerializer<PayloadType>,
Sourcepub fn new(
inner: MqttSubscriber<PayloadType, SerializerType>,
) -> MqttTopicSubscriber<MessageType, PayloadType, SerializerType>
pub fn new( inner: MqttSubscriber<PayloadType, SerializerType>, ) -> MqttTopicSubscriber<MessageType, PayloadType, SerializerType>
Creates a structured subscriber from a typed MQTT subscriber.
Sourcepub async fn receive(
&mut self,
) -> Option<Result<MessageType, MessageConversionError<<SerializerType as MessageSerializer<PayloadType>>::DeserializeError>>>
pub async fn receive( &mut self, ) -> Option<Result<MessageType, MessageConversionError<<SerializerType as MessageSerializer<PayloadType>>::DeserializeError>>>
Receives and converts the next MQTT message into structured type.
Auto Trait Implementations§
impl<MessageType, PayloadType, SerializerType> Freeze for MqttTopicSubscriber<MessageType, PayloadType, SerializerType>where
SerializerType: Freeze,
impl<MessageType, PayloadType, SerializerType> RefUnwindSafe for MqttTopicSubscriber<MessageType, PayloadType, SerializerType>
impl<MessageType, PayloadType, SerializerType> Send for MqttTopicSubscriber<MessageType, PayloadType, SerializerType>
impl<MessageType, PayloadType, SerializerType> Sync for MqttTopicSubscriber<MessageType, PayloadType, SerializerType>
impl<MessageType, PayloadType, SerializerType> Unpin for MqttTopicSubscriber<MessageType, PayloadType, SerializerType>
impl<MessageType, PayloadType, SerializerType> UnwindSafe for MqttTopicSubscriber<MessageType, PayloadType, SerializerType>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more