pub struct Context { /* private fields */ }Expand description
Contains additional information about the disconnect
This type internally tracks the number of times a disconnect has occurred, and the reason for the disconnect.
Implementations§
Source§impl Context
impl Context
Sourcepub fn current_reconnect_attempts(&self) -> usize
pub fn current_reconnect_attempts(&self) -> usize
The number of reconnect attempts since the last successful connection. Reset each time the connection is established
Sourcepub fn total_reconnect_attempts(&self) -> usize
pub fn total_reconnect_attempts(&self) -> usize
The total number of times a reconnect has been attempted.
The first time Resolver::disconnected or Resolver::unreachable is invoked this will
return 0, each subsequent time it will be incremented by 1.
Sourcepub fn reason(&self) -> &Reason
pub fn reason(&self) -> &Reason
Get the current reason for the disconnect
§Panics
Might, panic if called outside of the methods in resolver. Will also panic if called AFTER and error has been returned
Sourcepub fn try_reason(&self) -> Option<&Reason>
pub fn try_reason(&self) -> Option<&Reason>
Get the current optional reason for the disconnect
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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