Module toml
TOML parsing and serialization.
toml provides parsing and serialization support for the TOML format.
TOML is a configuration file format that's designed to be easy to read and write,
making it popular for configuration files in the Rust ecosystem, including Cargo.toml.
Examples
Parsing TOML from a string:
let toml_str = "name = \"example\"\nversion = 1";
let parsed: Value = from_str.unwrap;
assert_eq!;
assert_eq!;
Deserializing to a struct with serde:
use Deserialize;
let toml_str = r#"title = "Example"
[database]
host = "localhost"
port = 5432
"#;
let config: Config = from_str.unwrap;
assert_eq!;
assert_eq!;
Serializing a struct to TOML:
use Serialize;
let config = Config ;
let toml_string = to_string.unwrap;
assert!;
assert!;