Module serde

Module serde 

Source
Expand description

Serde support for humanized bandwidth.

§Example

use serde::{Serialize, Deserialize};
use bandwidth::Bandwidth;

#[derive(Serialize, Deserialize)]
struct Foo {
    #[serde(with = "human_bandwidth::serde")]
    bandwidth: Bandwidth,
}

Or use the Serde wrapper type:

use serde::{Serialize, Deserialize};
use human_bandwidth::serde::Serde;
use bandwidth::Bandwidth;

#[derive(Serialize, Deserialize)]
struct Foo {
    bandwidth: Vec<Serde<Bandwidth>>,
}

Structs§

Serde
A wrapper type which implements Serialize and Deserialize for types involving Bandwidth.

Functions§

deserialize
Deserializes a Bandwidth in human-readable format.
serialize
Serializes a Bandwidth in human-readable format.