#[non_exhaustive]pub enum ConnectionState {
#[non_exhaustive] Connecting {
attempt: u32,
},
#[non_exhaustive] Connected {
sid: String,
recovered: bool,
},
#[non_exhaustive] Disconnected {
reason: DisconnectReason,
error: Option<Error>,
},
#[non_exhaustive] Reconnecting {
attempt: u32,
delay: Duration,
error: Option<Error>,
},
#[non_exhaustive] Closed {
reason: DisconnectReason,
error: Option<Error>,
},
}Expand description
The connection lifecycle, published on every transition.
A network loss goes Connected -> Disconnected -> Reconnecting -> Connecting ->
(Reconnecting -> Connecting per failed attempt) -> Connected. Closed is final.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
#[non_exhaustive]Connecting
A connect attempt is running (attempt 0 is the initial connect).
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
#[non_exhaustive]Connected
The namespace is joined.
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
#[non_exhaustive]Disconnected
The connection was lost; a reconnect follows.
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§
reason: DisconnectReasonWhy.
#[non_exhaustive]Reconnecting
Waiting delay before reconnect attempt attempt.
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
#[non_exhaustive]Closed
Final: no more connects or events.
Fields
This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§
reason: DisconnectReasonWhy.
Implementations§
Trait Implementations§
Source§impl Clone for ConnectionState
impl Clone for ConnectionState
Auto Trait Implementations§
impl !RefUnwindSafe for ConnectionState
impl !UnwindSafe for ConnectionState
impl Forget for ConnectionState
impl Freeze for ConnectionState
impl Move for ConnectionState
impl Send for ConnectionState
impl Sync for ConnectionState
impl Unpin for ConnectionState
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more