pub(crate) struct TomlTree(DocumentMut);Expand description
A TOML document that reconciliation edits in place.
Tuple Fields§
§0: DocumentMutImplementations§
Source§impl TomlTree
impl TomlTree
pub(super) fn new() -> Self
pub(super) fn table_mut(&mut self) -> &mut Table
Sourcepub(super) fn set_header(&mut self, text: String)
pub(super) fn set_header(&mut self, text: String)
Set the header comment, which must end with a line break.
Sourcepub(super) fn align_with(&mut self, desired: &Self, existing: Existing)
pub(super) fn align_with(&mut self, desired: &Self, existing: Existing)
Carry over the comments and the generated header of desired, and
give every table an explicit position.
Without explicit positions a new subtable takes its place from its neighbours on the first run and from its position on the next, so reconciliation would need two runs to converge.
fn root_prefix(&self) -> Option<&str>
Sourcefn first_prefix(&self) -> &str
fn first_prefix(&self) -> &str
The decor text before the first entry. A parsed document keeps its leading comments on the first entry, not on the root table.
fn set_first_prefix(&mut self, text: String)
Trait Implementations§
Source§impl Editable for TomlTree
impl Editable for TomlTree
type Node = Item
Source§fn header_text(&self) -> &str
fn header_text(&self) -> &str
The text of the header comment of this document.
Source§fn leading(&self) -> (&str, &str)
fn leading(&self) -> (&str, &str)
The text before the first entry as the document root holds it and as
the first entry holds it. A format that keeps all of it in one place
returns an empty root text.
Source§fn set_leading(&mut self, applied: Applied<'_>)
fn set_leading(&mut self, applied: Applied<'_>)
Put the leading text of an applied header in place.
Source§fn apply_header(&mut self, desired: &Self, existing: Existing)
fn apply_header(&mut self, desired: &Self, existing: Existing)
Replace the leading comment block of this document with the header
of
desired.Auto Trait Implementations§
impl Freeze for TomlTree
impl RefUnwindSafe for TomlTree
impl Send for TomlTree
impl Sync for TomlTree
impl Unpin for TomlTree
impl UnsafeUnpin for TomlTree
impl UnwindSafe for TomlTree
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