Skip to main content

Module fmt

Module fmt 

Source
Expand description

Comment-preserving formatter for Sigma YAML.

format_yaml rewrites a Sigma file into the canonical layout that emit_rule_yaml produces, keeping comments, anchors, aliases, tags, and directives. Every result is checked against the source: the YAML values, the parsed Sigma rules, and the attachment of every comment must be unchanged, or the call fails with FormatError::Guard.

Structs§

FormatOutcome
The result of formatting a whole file.
RangeEdit
A single splice that replaces one region of the source with canonical text.

Enums§

FormatError
Why a file could not be formatted.

Functions§

format_yaml
Format a whole Sigma YAML file.
format_yaml_range
Format only the smallest block mapping that contains start..end.