[][src]Enum mqtt_async_client::client::KeepAlive

pub enum KeepAlive {
    Disabled,
    Enabled {
        secs: u16,
    },
}

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.

Fields of Enabled

secs: u16

The number of seconds between packets.

Methods

impl KeepAlive[src]

pub fn from_secs(secs: u16) -> KeepAlive[src]

Set keep alive time in seconds.

Panics if secs parameter is 0.

pub fn disabled() -> KeepAlive[src]

Disable keep alive functionality.

pub fn is_enabled(&self) -> bool[src]

Returns whether keep alives are enabled.

pub fn is_disabled(&self) -> bool[src]

Returns whether keep alives are disabled.

pub fn as_duration(&self) -> Option<Duration>[src]

Returns the keep alive interval if enabled as Some(tokio::Duration), or None if disabled.

Trait Implementations

impl Clone for KeepAlive[src]

impl Copy for KeepAlive[src]

impl Debug for KeepAlive[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.