[][src]Enum spirit_tokio::net::MaybeDuration

pub enum MaybeDuration {
    Unset,
    Off,
    Duration(Duration),
}

Configuration that can be unset, explicitly turned off or set to a duration.

Some network configuration options can be either turned off or set to a certain duration. We add the ability to leave them on the OS default (which is done if the field is not present in the configuration).

Panics

If using on your own and using Serialize, make sure that you use #[serde(skip_serializing_if = "MaybeDuration::is_unset")], or you'll get a panic during serialization.

Variants

Unset

Leaves the option at the OS default.

Signified by not being present in the configuration.

Off

Turns the option off.

Deserialized from false.

Duration(Duration)

Turns the option on with given duration.

Deserialized from human-readable duration specification, eg. 100ms or 30s.

Trait Implementations

impl Clone for MaybeDuration[src]

impl Copy for MaybeDuration[src]

impl Debug for MaybeDuration[src]

impl Default for MaybeDuration[src]

impl<'de> Deserialize<'de> for MaybeDuration[src]

impl Eq for MaybeDuration[src]

impl Hash for MaybeDuration[src]

impl Ord for MaybeDuration[src]

impl PartialEq<MaybeDuration> for MaybeDuration[src]

impl PartialOrd<MaybeDuration> for MaybeDuration[src]

impl Serialize for MaybeDuration[src]

impl StructuralEq for MaybeDuration[src]

impl StructuralPartialEq for MaybeDuration[src]

Auto Trait Implementations

impl RefUnwindSafe for MaybeDuration

impl Send for MaybeDuration

impl Sync for MaybeDuration

impl Unpin for MaybeDuration

impl UnwindSafe for MaybeDuration

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

impl<T> IntoResult<T> for 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.