Home

rustfmttoml

rustfmttoml is an open‑source Rust library that provides automated formatting for TOML (Tom's Obvious Minimal Language) documents. The project was initiated in 2022 by a group of contributors interested in improving the readability and consistency of TOML configuration files through a tool that follows idiomatic Rust conventions. The crate is hosted on crates.io and its source code is maintained in a public repository on GitHub, where it is licensed under the MIT / Apache‑2.0 dual license.

The primary goal of rustfmttoml is to offer a deterministic, style‑aware formatter that can be integrated into

rustfmttoml can be invoked as a library function within Rust programs, or through a command‑line interface

The crate has attracted contributions from the Rust community and is used in several projects that rely

Rust
development
workflows.
It
parses
TOML
input
using
the
toml
crate,
constructs
an
abstract
syntax
tree,
and
then
re‑emits
the
document
according
to
a
configurable
set
of
formatting
rules.
These
rules
cover
whitespace
handling,
indentation,
ordering
of
table
keys,
and
line
wrapping
for
long
strings.
By
default,
the
formatter
adopts
a
4‑space
indentation
style
and
aligns
tables
and
arrays
to
improve
visual
hierarchy.
that
reads
files
from
standard
input
or
from
a
specified
path.
The
CLI
supports
options
such
as
in‑place
editing,
diff
output,
and
custom
configuration
files
written
in
TOML.
Integration
with
cargo‑fmt
and
other
toolchains
is
straightforward,
allowing
developers
to
chain
formatting
steps
for
both
Rust
source
code
and
associated
TOML
configuration
files.
on
consistent
TOML
formatting,
including
cargo‑metadata
generators
and
CI
pipelines.
Ongoing
development
focuses
on
expanding
rule
configurability,
improving
error
reporting,
and
maintaining
compatibility
with
the
latest
TOML
specifications.