#[non_exhaustive]pub enum DisconnectReason {
Shutdown,
Restart,
Other(String),
}Expand description
Reason for service disconnection.
§Wire forward-compatibility
Other(String) is a catch-all for reason strings received from a newer
peer that this build does not yet recognise. Serde deserialization is
infallible: an unknown string becomes Other(...) rather than a parse
error, allowing rolling upgrades without dropping the Disconnecting message.
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.
Shutdown
SIGTERM/SIGINT - clean exit.
Restart
SIGHUP - will reconnect after external restart.
Other(String)
An unknown reason received from a newer peer.
The inner string is the raw snake_case value as it appeared on the wire.
Implementations§
Source§impl DisconnectReason
impl DisconnectReason
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the string representation.
For DisconnectReason::Other, returns the inner string as-is.
Trait Implementations§
Source§impl Clone for DisconnectReason
impl Clone for DisconnectReason
Source§fn clone(&self) -> DisconnectReason
fn clone(&self) -> DisconnectReason
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DisconnectReason
impl Debug for DisconnectReason
Source§impl<'de> Deserialize<'de> for DisconnectReason
impl<'de> Deserialize<'de> for DisconnectReason
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DisconnectReason
impl Display for DisconnectReason
impl Eq for DisconnectReason
Source§impl From<String> for DisconnectReason
impl From<String> for DisconnectReason
Source§impl PartialEq for DisconnectReason
impl PartialEq for DisconnectReason
Source§impl Serialize for DisconnectReason
impl Serialize for DisconnectReason
impl StructuralPartialEq for DisconnectReason
Auto Trait Implementations§
impl Freeze for DisconnectReason
impl RefUnwindSafe for DisconnectReason
impl Send for DisconnectReason
impl Sync for DisconnectReason
impl Unpin for DisconnectReason
impl UnsafeUnpin for DisconnectReason
impl UnwindSafe for DisconnectReason
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Compare self to
key and return true if they are equal.