talira

toml (toml-rs)

TOML encoder, decoder and format-preserving editor for Rust

open sourceMIT OR Apache-2.0free

toml is the Rust crate for reading and writing TOML: a Serde-compatible decoder and encoder that turns TOML files into Rust structures and back. Its sibling crate toml_edit parses and modifies TOML documents while keeping their comments, spacing and the order of items, which is what cargo-edit needs; the same repository has toml_datetime, serde_spanned for spans of keys and values, and the low-level toml_parser and toml_writer. It is dual licensed under MIT or Apache-2.0.

Problems it solves

  • read my Rust app's config file written in TOML
  • change a value in a Cargo.toml without losing its comments
  • write Rust structs out as a TOML file

Features

  • serde Serialize and Deserialize for TOML
  • format-preserving editing that keeps comments, spacing and order (toml_edit)
  • spans of keys and values when deserializing (serde_spanned)
  • low-level TOML lexer, parser and writer

Alternatives

The same job

These do what toml (toml-rs) does.

  1. Serde Rust's framework for serializing and deserializing data structures

Compare toml (toml-rs) with the top 3