pub trait ToFlattened {
// Required method
fn to_flattened<'a>(
&'a self,
arena: &'a Arena,
table: &mut Table<'a>,
) -> Result<(), ToTomlError>;
}Available on crate feature
to-toml only.Expand description
Trait for types that can be converted into flattened TOML table entries.
Used with #[toml(flatten)] on struct fields. Built-in implementations
cover HashMap and BTreeMap.
If your type implements ToToml, use
#[toml(flatten, with = flatten_any)] in your derive instead of
implementing this trait. See helper::flatten_any.
Required Methods§
Sourcefn to_flattened<'a>(
&'a self,
arena: &'a Arena,
table: &mut Table<'a>,
) -> Result<(), ToTomlError>
fn to_flattened<'a>( &'a self, arena: &'a Arena, table: &mut Table<'a>, ) -> Result<(), ToTomlError>
Inserts this value’s entries directly into an existing table.
Each key-value pair is inserted into table rather than wrapping
them in a nested sub-table.