pub(crate) struct Toml {
pub(super) inline_width: InlineWidth,
format: Format,
}Expand description
Reconciles TOML documents, rendering inline tables up to a fixed width.
Fields§
§inline_width: InlineWidth§format: FormatImplementations§
Source§impl Toml
impl Toml
pub(crate) const fn new(inline_width: InlineWidth) -> Self
pub(super) const fn unsupported(self, feature: Feature) -> DocumentError
Source§impl Toml
impl Toml
Sourcefn key_comment(parent: &Item, key: &str) -> Option<String>
fn key_comment(parent: &Item, key: &str) -> Option<String>
The comment above the value key key of parent, if it has one.
fn set_key_comment( table: &mut dyn TableLike, key: &str, comment: Option<String>, )
Sourcefn trim_leading_blank_lines(table: &mut Table)
fn trim_leading_blank_lines(table: &mut Table)
Drop the blank lines before the first entry of table, which only
separated it from an entry that is gone.
Sourcefn replace_keeping_decor(old: &Item, new: Item) -> Item
fn replace_keeping_decor(old: &Item, new: Item) -> Item
new, with the decor of the item it replaces so that the user’s
spacing and comments stay. A table keeps the comment above its header
unless the new table brings one, and then keeps the blank lines above
the old one.
Source§impl Toml
impl Toml
pub(super) fn build_document( self, annotated: &Annotated, ) -> Result<TomlTree, DocumentError>
fn populate_table( self, table: &mut Table, entries: &Entries, is_root: bool, ) -> Result<(), DocumentError>
Sourcefn has_header(item: &Item) -> bool
fn has_header(item: &Item) -> bool
Whether item is printed under a header of its own.
fn item( self, key: &str, annotated: &Annotated, is_root: bool, ) -> Result<Item, DocumentError>
Sourcefn fits_inline(self, key: &str, inline: &InlineTable) -> bool
fn fits_inline(self, key: &str, inline: &InlineTable) -> bool
Whether key = inline fits within the configured columns.
fn array_item(self, items: &[Annotated]) -> Result<Item, DocumentError>
fn array(self, items: &[Annotated]) -> Result<Array, DocumentError>
Sourcefn spread(array: &mut Array, items: &[Annotated])
fn spread(array: &mut Array, items: &[Annotated])
Put every item on its own line, with its comment above it.
Sourcefn inline_value(self, annotated: &Annotated) -> Result<TomlValue, DocumentError>
fn inline_value(self, annotated: &Annotated) -> Result<TomlValue, DocumentError>
A value inside an inline table, which cannot hold comments.
fn array_value(self, annotated: &Annotated) -> Result<TomlValue, DocumentError>
fn scalar(self, scalar: &Scalar) -> Result<TomlValue, DocumentError>
const fn unvalidated(feature: Feature) -> DocumentError
fn styled_string( self, text: &str, style: StringStyle, ) -> Result<TomlValue, DocumentError>
fn literal_string(self, text: &str) -> Result<TomlValue, DocumentError>
fn inline_table(self, entries: &Entries) -> Result<InlineTable, DocumentError>
fn write_comment(out: &mut String, comment: &Comment, indent: &str)
Sourcefn comment_first_leaf(table: &mut Table, prefix: String)
fn comment_first_leaf(table: &mut Table, prefix: String)
Put prefix before the first line of a dotted table, which prints the
decor of its leaf keys.
fn attach_comment(table: &mut Table, key: &str, comment: &Comment)
Trait Implementations§
Source§impl Backend for Toml
impl Backend for Toml
type Document = TomlTree
Source§fn parse(&self, source: &str) -> Result<TomlTree, DocumentError>
fn parse(&self, source: &str) -> Result<TomlTree, DocumentError>
Source§fn build(&self, desired: &Annotated) -> Result<TomlTree, DocumentError>
fn build(&self, desired: &Annotated) -> Result<TomlTree, DocumentError>
Source§fn string_leaf(&self, node: &Item) -> Result<Option<String>, DocumentError>
fn string_leaf(&self, node: &Item) -> Result<Option<String>, DocumentError>
Source§fn finish(&self, current: &mut TomlTree, desired: &TomlTree, existing: Existing)
fn finish(&self, current: &mut TomlTree, desired: &TomlTree, existing: Existing)
Source§fn descend<'n>(
&self,
node: &'n <<Self as Backend>::Document as Editable>::Node,
key: &str,
_path: &[String],
) -> Result<Option<&'n <<Self as Backend>::Document as Editable>::Node>, DocumentError>
fn descend<'n>( &self, node: &'n <<Self as Backend>::Document as Editable>::Node, key: &str, _path: &[String], ) -> Result<Option<&'n <<Self as Backend>::Document as Editable>::Node>, DocumentError>
key of node, which sits at path. Backends fail here
when a node on the way cannot be read through. Read moreSource§fn explain(&self, _current: &Self::Document, error: MergeError) -> DocumentError
fn explain(&self, _current: &Self::Document, error: MergeError) -> DocumentError
current. Backends can
name a cause more precisely than the generic conflict.