pub fn format(src: &str) -> Result<String, FormatError>Expand description
Formats SystemRDL source.
There is nothing to configure, deliberately: a formatter earns its value by ending arguments, not by relocating them into a config file. Indentation is four spaces, which is what the PeakRDL style guide asks for.
The output is verified before it is returned: see verify. A caller that
gets Ok has a guarantee, not just a hope, that only whitespace moved.
ยงErrors
FormatError::Parse if src does not parse cleanly. The source is left
for the caller to report on rather than being passed through unchanged, so
that a broken file is never silently mistaken for a formatted one.
FormatError::Corrupted if the formatter has a bug.