| Crates.io | soml |
| lib.rs | soml |
| version | 0.2.0 |
| created_at | 2025-07-17 22:21:53.654776+00 |
| updated_at | 2025-08-04 23:38:15.572065+00 |
| description | A lightweight Serde-compatible TOML parser |
| homepage | |
| repository | https://github.com/staticintlucas/soml |
| max_upload_size | |
| id | 1758249 |
| size | 731,803 |
A lightweight Serde-compatible TOML parser written in Rust
The toml crate has lots of amazing features, but that makes it really heavy in terms of binary size and compile times. For one of my other projects toml accounted for over 15% of the compiled binary size despite only being used to read one small config file.
This project designed to sit at the opposite end of the spectrum, offering basic TOML support for Serde with a much smaller footprint. See the comparison table below for a more detailed comparison of TOML crates.
We also aim to be mostly API-compatibility with the toml crate, so migrating to (or from) soml should be relatively easy.
| Feature | Default | Description |
|---|
std | ✅ | Enables std support
strict | ✅ | Enables extra checks for strict compliance with the TOML spec (see below)
datetime | ✅ | Enables support for TOML date-time values
strict featureThe (enabled by default) strict feature adds certain checks required to validate compliance with the TOML spec.
These checks can be disabled allowing the parser accept some unambiguous but not-technically-valid TOML.
For some applications disabling the strict feature could yield a small performance improvement.
The following checks are currently disabled without the strict feature:
2024-14-35T25:61:63 is invalidℹ️ Important
The exact list of checks controlled by the strict feature is considered an implementation detail and is subject to change.
Changes to which not-strictly-valid TOML is accepted when strict is disabled is not considered a breaking change.
These tables are autogenerated by binsize/main.py:
| Crate | Version | Size * | Maintained | TOML version |
|---|---|---|---|---|
| soml | 0.2.0 | 103 KiB | ✅ | 1.0 |
| soml ( datetime disabled) |
0.2.0 | 98 KiB | ✅ | 1.0 † |
| toml | 0.9.5 | 164 KiB | ✅ | 1.0 |
| toml | 0.8.23 | 231 KiB | ✅ | 1.0 |
| toml | 0.5.11 | 114 KiB | ❌ | 0.5 |
| basic-toml | 0.1.10 | 117 KiB | ❌ | 0.5 † |
* Increase in code (.text) size compared to just reading/writing a file without (de)serializing.
This is calculated using cargo-bloat with the default release profile.
† Does not support TOML date-time types.
| Crate | Version | Size * | Maintained | TOML version |
|---|---|---|---|---|
| soml | 0.2.0 | 128 KiB | ✅ | 1.0 |
| soml ( datetime disabled) |
0.2.0 | 122 KiB | ✅ | 1.0 † |
| toml | 0.9.5 | 186 KiB | ✅ | 1.0 |
| toml | 0.8.23 | 320 KiB | ✅ | 1.0 |
| toml | 0.5.11 | 127 KiB | ❌ | 0.5 |
| basic-toml | 0.1.10 | 127 KiB | ❌ | 0.5 † |
* Increase in code (.text) size compared to just reading/writing a file without (de)serializing.
This is calculated using cargo-bloat with the default release profile.
† Does not support TOML date-time types.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.