pub enum KeepAlive {
Disabled,
Enabled {
secs: u16,
},
}
Expand description
Represents the keep alive setting for a client.
Variants§
Disabled
Keep alive ping packets are disabled.
Enabled
Send a keep alive ping packet every secs
seconds.
Implementations§
Source§impl KeepAlive
impl KeepAlive
Sourcepub fn from_secs(secs: u16) -> KeepAlive
pub fn from_secs(secs: u16) -> KeepAlive
Set keep alive time in seconds.
Panics if secs
parameter is 0.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether keep alives are enabled.
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
Returns whether keep alives are disabled.
Sourcepub fn as_duration(&self) -> Option<Duration>
pub fn as_duration(&self) -> Option<Duration>
Returns the keep alive interval if enabled as Some(tokio::Duration), or None if disabled.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeepAlive
impl RefUnwindSafe for KeepAlive
impl Send for KeepAlive
impl Sync for KeepAlive
impl Unpin for KeepAlive
impl UnwindSafe for KeepAlive
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