pub enum ConnectionState {
Disconnected,
Connected,
ConnectionLost,
SessionExpired,
}Expand description
Observable connection state of a Request or Subscribe handle.
Transitions are session-layer only — the NNG dialer’s own redial
loop runs underneath and doesn’t generate a separate observable
state. The caller sees Connected → ConnectionLost → Connected
(or → SessionExpired) and nothing in between.
Variants§
Disconnected
Initial state + after a successful disconnect().
Connected
Socket is up, session is restored (if one was ever established).
ConnectionLost
NNG pipe event REM_POST fired. The dialer is redialling the
transport underneath; we’ll transition back to Connected (or
to SessionExpired) once the pipe comes back.
SessionExpired
The socket came back, but RestoreSession(token) was rejected.
Caller action required — re-login with fresh credentials, or
give up. The library will not silently re-login with cached
credentials.
Implementations§
Source§impl ConnectionState
impl ConnectionState
Sourcepub fn is_connected(self) -> bool
pub fn is_connected(self) -> bool
Convenience: is the socket currently usable for RPCs?
Sourcepub fn is_terminal(self) -> bool
pub fn is_terminal(self) -> bool
Convenience: is this a terminal state that needs caller action?
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 moreimpl Copy for ConnectionState
Source§impl Debug for ConnectionState
impl Debug for ConnectionState
impl Eq for ConnectionState
Source§impl Hash for ConnectionState
impl Hash for ConnectionState
Source§impl PartialEq for ConnectionState
impl PartialEq for ConnectionState
Source§fn eq(&self, other: &ConnectionState) -> bool
fn eq(&self, other: &ConnectionState) -> bool
self and other values to be equal, and is used by ==.