#[non_exhaustive]pub enum ConnectionState {
#[non_exhaustive] Connected {
session_present: bool,
},
#[non_exhaustive] Reconnecting {
attempt: u32,
},
#[non_exhaustive] Disconnected {
reason: DisconnectReason,
},
}Expand description
The connection’s current lifecycle state.
Designed v5-first: every variant is #[non_exhaustive] so protocol-5 fields
(reason codes, properties) can be added without a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]Connected
The connection is up. session_present reports whether the broker
resumed an existing session (v4 CONNACK today; v5 CONNACK identically
later) — false means a clean session, so subscriptions were
re-established by the client.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Reconnecting
The connection was lost and the backend is retrying. attempt is the
number of consecutive poll failures since the last successful poll; it
resets to 0 on any success (a reconnect, a delivered message, or another
notification). It is tracked separately from the internal error counter
that drives backoff and DisconnectReason::MaxErrorsExceeded, so a
broker that keeps reconnecting is not permanently killed yet a truly
unreachable broker still terminates.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]Disconnected
Terminal. The event loop has exited; no further transitions occur and
every subscriber’s receive() now yields None.
Fields
This variant is marked as non-exhaustive
reason: DisconnectReasonWhy the event loop terminated.
Trait Implementations§
Source§impl Clone for ConnectionState
impl Clone for ConnectionState
Source§fn clone(&self) -> ConnectionState
fn clone(&self) -> ConnectionState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectionState
impl Debug for ConnectionState
impl Eq for ConnectionState
Source§impl PartialEq for ConnectionState
impl PartialEq for ConnectionState
impl StructuralPartialEq for ConnectionState
Auto Trait Implementations§
impl Freeze for ConnectionState
impl RefUnwindSafe for ConnectionState
impl Send for ConnectionState
impl Sync for ConnectionState
impl Unpin for ConnectionState
impl UnsafeUnpin for ConnectionState
impl UnwindSafe for ConnectionState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.