TOML
Recipe | Crates | Categories |
---|---|---|
basic_toml | ||
toml_edit | ||
toml |
toml
⮳ is the primary crate.
toml
toml
⮳ is a native Rust encoder and decoder of TOML-formatted files and streams. Provides implementations of the standard Serialize/Deserialize traits for TOML data to facilitate deserializing and serializing Rust structures.
use serde::Deserialize; use toml::value::Datetime; #[derive(Deserialize, Debug)] struct Config { title: String, database: Database, } #[derive(Deserialize, Debug)] struct Database { server: String, ports: Vec<u32>, connection_max: u32, enabled: bool, date: Datetime, } fn main() { let toml_string = r#" title = "TOML Example" [database] server = "192.168.1.1" ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true date = 1979-05-27T07:32:00Z "#; let parsed_toml: Config = toml::from_str(toml_string).unwrap(); println!("{:#?}", parsed_toml); }
toml_edit
toml_edit
⮳ is a format-preserving TOML parser.
// // COMING SOON
basic_toml
basic_toml
⮳ is a minimal TOML library with few dependencies
// // COMING SOON