pub struct Connection {
pub eventloop: EventLoop,
/* private fields */
}Expand description
MQTT connection. Maintains all the necessary state
Fields§
§eventloop: EventLoopImplementations§
Source§impl Connection
impl Connection
Sourcepub const fn iter(&mut self) -> Iter<'_> ⓘ
pub const fn iter(&mut self) -> Iter<'_> ⓘ
Returns an iterator over this connection. Iterating over this is all that’s necessary to make connection progress and maintain a robust connection. Just continuing to loop will reconnect NOTE Don’t block this while iterating
Sourcepub fn try_recv(
&mut self,
) -> Result<Result<Event, ConnectionError>, TryRecvError>
pub fn try_recv( &mut self, ) -> Result<Result<Event, ConnectionError>, TryRecvError>
Attempt to fetch an incoming Event on the EventLoop, returning an error
if none immediately present or all clients/users have closed requests channel.
§Errors
Returns TryRecvError::Empty if no event is immediately ready, or
TryRecvError::Disconnected if all request senders have been dropped.
Sourcepub fn recv_timeout(
&mut self,
duration: Duration,
) -> Result<Result<Event, ConnectionError>, RecvTimeoutError>
pub fn recv_timeout( &mut self, duration: Duration, ) -> Result<Result<Event, ConnectionError>, RecvTimeoutError>
Attempt to fetch an incoming Event on the EventLoop, returning an error
if all clients/users have closed requests channel or the timeout has expired.
§Errors
Returns RecvTimeoutError::Timeout if no event arrives before
duration, or RecvTimeoutError::Disconnected if all request
senders have been dropped.