pub struct Config {
pub keys: Vec<String>,
pub inline_keys: Vec<String>,
pub section_keys: HashMap<String, Vec<String>>,
pub sort_arrays: bool,
pub excludes: Vec<String>,
pub indent: String,
pub multiline_array_threshold: Option<usize>,
pub normalize_comments: bool,
pub expand_dotted_keys: bool,
}Fields§
§keys: Vec<String>Important keys in non-inline tables. Will be sorted first, then any non-important keys will be sorted lexicographically.
inline_keys: Vec<String>Important keys in inline tables. Will be sorted first, then any non-important keys will be sorted lexicographically.
section_keys: HashMap<String, Vec<String>>Per-table key ordering overrides. Maps a table name to a list
of priority keys for that table, overriding the global keys.
sort_arrays: boolDoes it sort arrays? In case of mixed types, string will be ordered first, then other values in original order.
excludes: Vec<String>Paths to ignore when scanning directories.
indent: StringIndentation string for multiline array elements.
Defaults to a tab character. Use spaces (e.g. " " or " ")
to match your project’s style.
multiline_array_threshold: Option<usize>Minimum number of array elements to force multi-line formatting.
Arrays with at least this many elements will be expanded to multi-line
even if they were originally written inline. null (default) means
never force multi-line.
normalize_comments: boolEnsure a space after # in comments (e.g. #foo → # foo).
Default: false.
expand_dotted_keys: boolIf true, dotted keys (a.b.c = 1) are rewritten as [a.b]
headers with c = 1 underneath. Default: false (preserve as written).
Implementations§
Source§impl Config
impl Config
pub fn read_from_file() -> Option<Config>
Sourcepub fn process_file(
&self,
path: impl AsRef<Path>,
mode: Mode,
verbose: bool,
) -> Res<()>
pub fn process_file( &self, path: impl AsRef<Path>, mode: Mode, verbose: bool, ) -> Res<()>
Process the provided file.
Sourcepub fn format_inline_table(
&self,
table: &InlineTable,
last: bool,
) -> Res<InlineTable>
pub fn format_inline_table( &self, table: &InlineTable, last: bool, ) -> Res<InlineTable>
Format inline tables { key = value, key = value }.
TOML doesn’t seem to support inline comments, so we just override entries decors
to respect proper spaces.