#[non_exhaustive]pub enum ClosedReason {
ByClient,
ByServer(ServerError),
ReconnectExhausted {
attempts: u32,
last: Option<Box<DisconnectReason>>,
},
Internal {
reason: String,
},
}Expand description
Why the session ended for good.
After this the client is inert: every operation returns
Error::Disconnected and no further event arrives.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ByClient
You asked for it — Client::disconnect,
or the client was dropped.
ByServer(ServerError)
The server ended the session, or refused to start one, with an
Appendix A code that admits no retry
[docs/spec/05-error-codes.md §2].
ReconnectExhausted
The connection kept failing and the reconnection budget ran out.
Fields
last: Option<Box<DisconnectReason>>Why the last attempt failed, when there was one to report.
The count alone says a client gave up; it does not say whether the
server was refusing the credentials, the socket never opened, or
the connection kept going silent — which are three different
things to do about it. This is that answer, in the same vocabulary
SessionEvent::Disconnected uses.
Internal
A failure inside this crate. A bug; please report it.
Implementations§
Source§impl ClosedReason
impl ClosedReason
Sourcepub fn into_error(self) -> Error
pub fn into_error(self) -> Error
The same reason expressed as an Error, for a caller that wants to
propagate it with ?.
§Examples
use lightstreamer_rs::{ClosedReason, Error};
let reason = ClosedReason::ReconnectExhausted { attempts: 8, last: None };
assert!(matches!(reason.into_error(), Error::ReconnectExhausted { attempts: 8, .. }));Trait Implementations§
Source§impl Clone for ClosedReason
impl Clone for ClosedReason
Source§fn clone(&self) -> ClosedReason
fn clone(&self) -> ClosedReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more