pub struct FormatSpec { /* private fields */ }Expand description
A format plus the extensions it reads — one entry of Options::formats.
Accepted forms (all .into()):
Format::Yamlor"yaml"— default extensions(Format::Yaml, ["yml", "conf"])or("yaml", ["yml", "conf"])— custom extensions(Format::Csv, ["csv"], "db")— custom extensions plus aTableLayout(a layout id string, aTableLayout, or aCustomLayout): every file this entry claims parses under that layout, in merge mode, tree mode and single-file path sources alike. Table sources override it; string sources stayKv; a layout on a non-table format panics at conversion. Without this form an entry uses the format’s default layout (Format::default_layout).- a
CustomFormat— user-defined parser with the extensions it was built with
Trait Implementations§
Source§impl Clone for FormatSpec
impl Clone for FormatSpec
Source§impl Debug for FormatSpec
impl Debug for FormatSpec
Source§impl From<&str> for FormatSpec
impl From<&str> for FormatSpec
Source§impl<const N: usize, L: Into<TableLayout>> From<(&str, [&str; N], L)> for FormatSpec
Panics on an unknown format or layout id — this is config-time code.
impl<const N: usize, L: Into<TableLayout>> From<(&str, [&str; N], L)> for FormatSpec
Panics on an unknown format or layout id — this is config-time code.
Source§impl<const N: usize, L: Into<TableLayout>> From<(Format, [&str; N], L)> for FormatSpec
In a formats entry the third element is always a layout (a
string must be a valid layout id — extensions have no sheet meaning).
Panics on unknown ids, and on a layout for a non-table format
((Format::Yaml, ["yml"], "db")) — this is config-time code.
impl<const N: usize, L: Into<TableLayout>> From<(Format, [&str; N], L)> for FormatSpec
In a formats entry the third element is always a layout (a
string must be a valid layout id — extensions have no sheet meaning).
Panics on unknown ids, and on a layout for a non-table format
((Format::Yaml, ["yml"], "db")) — this is config-time code.
Source§impl From<CustomFormat> for FormatSpec
impl From<CustomFormat> for FormatSpec
Source§fn from(custom: CustomFormat) -> Self
fn from(custom: CustomFormat) -> Self
Converts to this type from the input type.
Source§impl From<Format> for FormatSpec
impl From<Format> for FormatSpec
Source§impl PartialEq for FormatSpec
impl PartialEq for FormatSpec
impl StructuralPartialEq for FormatSpec
Auto Trait Implementations§
impl !RefUnwindSafe for FormatSpec
impl !UnwindSafe for FormatSpec
impl Freeze for FormatSpec
impl Send for FormatSpec
impl Sync for FormatSpec
impl Unpin for FormatSpec
impl UnsafeUnpin for FormatSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more