pub enum Format {
Json,
Jsonc,
Yaml,
Toml,
Ini,
Env,
Csv,
Excel,
Ods,
}Expand description
A config file format.
The variants always exist; whether a format can actually be parsed
depends on the matching Cargo feature. Which extensions a format reads
is part of FormatSpec.
Variants§
Json
Jsonc
Yaml
Toml
Ini
Env
Csv
Excel
Excel workbooks (xlsx/xlsm/xlsb/xls) — a binary
table-shaped format; file sources only. Feature excel.
Ods
OpenDocument spreadsheets (ods) — a binary table-shaped format;
file sources only. Feature ods.
Implementations§
Source§impl Format
impl Format
Sourcepub fn from_id(id: &str) -> Option<Format>
pub fn from_id(id: &str) -> Option<Format>
Look a format up by its string id ("json", "jsonc", "yaml",
"toml", "ini", "env", "csv", "excel", "ods").
Sourcepub fn default_extensions(self) -> &'static [&'static str]
pub fn default_extensions(self) -> &'static [&'static str]
The extensions (without the dot) this format claims by default.
Extension matching is always case-insensitive, and a hidden file
named .X is treated as having extension X (so .env matches the
env extension).
Sourcepub fn default_layout(self) -> TableLayout
pub fn default_layout(self) -> TableLayout
The default TableLayout of this format: db for the
spreadsheet formats (excel/ods — a sheet is a record grid unless
told otherwise), kv for csv (and, vacuously, for the non-table
formats, which never consult a layout).
Sourcepub fn exts<I, S>(self, extensions: I) -> FormatSpec
pub fn exts<I, S>(self, extensions: I) -> FormatSpec
Pair this format with custom extensions.