A collection of Rust crates for parsing, editing, and serializing TOML files with serde support and format preservation.
toml-rs is a comprehensive Rust library suite for working with TOML (Tom's Obvious, Minimal Language) configuration files. It provides both high-level serde integration for serializing and deserializing Rust structs and low-level, format-preserving manipulation for editing TOML documents without losing comments or formatting.
Rust application developers who need reliable configuration handling and tool builders who require precise manipulation of TOML files, such as those creating linters, formatters, or configuration editors.
Developers choose toml-rs because it uniquely combines seamless serde integration with format-preserving editing, offering both ease of use for common tasks and fine-grained control for advanced manipulation, all within a consistent and modular crate ecosystem.
Rust TOML Parser
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The `toml` crate directly supports serializing and deserializing Rust structs with serde, enabling type-safe configuration handling as highlighted in the README.
With `toml_edit`, TOML documents can be modified while retaining comments, whitespace, and original formatting, which is essential for tools like linters or formatters.
Crates like `toml_parser` and `toml_writer` provide fine-grained access to TOML syntax for custom parsing and writing, as mentioned in the key features.
The `serde_spanned` crate captures source locations (spans) during deserialization, improving error messages by pointing to exact lines in TOML files.
The project is split into multiple crates (e.g., toml, toml_edit, toml_datetime), complicating dependency management and increasing build times for simple use cases.
Developers must understand which crate to use for specific tasks, such as choosing between `toml` for serde and `toml_edit` for editing, which can be confusing initially.
Format-preserving parsing in `toml_edit` and low-level tools may introduce performance penalties compared to lightweight TOML parsers that skip formatting preservation.