tomling is a TOML parser API, that is designed to have minimal dependencies and is no_std
compatible. The main target is Cargo manifests (Cargo.toml files) and hence why specific API is
provided for that purpose as well.
Abandoned
As of 2025-07-09, this crate has been abandoned in favor of toml crate, which now supports all
the important use cases this crate provides, has minimal dependencies, supports no_std and (unlike
this crate) provides full compatibility with the specification.
The only feature of tomling that toml does not provide, is the specific Cargo API. However,
that can be easily developed on top of toml. If you're interested in that, feel free to take the
relevant code from this crate (specifically the cargo module) and port it (which should be
trivial) on top of toml. @zeenix may do that at some point. :)
Usage
//
// Using the `Cargo.toml` specific API:
//
#
#
//
// Using the generic raw `TOML` parsing API:
//
let manifest = parse.unwrap;
let package = manifest.get.unwrap.as_table.unwrap;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
let deps = manifest.get.unwrap.as_table.unwrap;
let serde = deps.get.unwrap.as_table.unwrap;
assert_eq!;
let serde_features =
serde.get.unwrap.as_array.unwrap.as_slice;
assert_eq!;
let regex = deps.get.unwrap.as_str.unwrap;
assert_eq!;
const CARGO_TOML: &'static str = r#"
[package]
name = "example"
version = "0.1.0"
edition = "2021"
authors = ["Alice Great <foo@bar.com>", "Bob Less"]
resolver = "2"
[dependencies]
serde = { version = "1.0", features = [
"std",
"derive", # and here.
] }
regex = "1.5"
[target.'cfg(unix)'.build-dependencies]
cc = "1.0.3"
[features]
default = ["serde"]
[[bin]]
name = "some-binary"
path = "src/bin/my-binary.rs"
"#;
Dependencies
winnowwithallocandsimdfeatures enabled.serde(optional) withallocandderivefeatures enabled.
Features
serde- Enables Serde support.cargo-toml- Enables Cargo manifest specific API. This requiresserde.simd- Enables thesimdfeature ofwinnowfor SIMD acceleration for parsing.std- Enables some features, likestd::error::Errorimplementation forErrortype. It also enablesstdfeature ofwinnowandserde.
All features are enabled by default.
Comparison with toml crate
The toml crate is great but it being based on toml_edit, it ends up requiring indexmap
crate and its dependencies. tomling was created specifically to avoid most of these dependencies
by focusing completely on the parsing of TOML documents only.
(As of 2025-07-09, the above is no longer the case and that's why this crate is now abandoned in
favor of toml crate)
Having said that, some of the code (especially the low-level parsing code) is inspired (or in some
cases, copied) from the toml_edit crate.
Goals
- Simple parser/deserializer API.
- Minimum dependencies. The only mandatory dependency is
winnowwith only 2 features enabled. - Primary target: Cargo manifests.
Non-goals
- Encoder/Serializer API.
License
The Name
The name "tomling" is a portmanteau of "TOML" and "ling" (a suffix meaning "a small thing"). Coincidentally, it also means a "male kitten" in English, with all the stress on the "kitten" part 😸 and none on the "male" part.