Expand description
A byte count from "64MiB", "1GB", or a bare number.
Both conventions are supported and they are not the same: KiB/MiB/GiB
are powers of 1024, KB/MB/GB powers of 1000. A bare K/M/G is
read as the binary form, which is what everyone means when they type it into
a config file.
use serde::Deserialize;
#[derive(Deserialize)]
struct Config {
#[serde(with = "dynamic_config::bytes")]
max_body: u64,
}Strict about nonsense: an unknown unit is an error naming what was expected, never a silent zero.
Functionsยง
- deserialize
#[serde(with = "dynamic_config::bytes")]- parse
- Parses a byte-size string.
- serialize
- Errors