Skip to main content

Editable

Trait Editable 

Source
pub(crate) trait Editable {
    type Node: Node;

    // Required methods
    fn header_text(&self) -> &str;
    fn leading(&self) -> (&str, &str);
    fn root(&self) -> &Self::Node;
    fn root_mut(&mut self) -> &mut Self::Node;
    fn set_leading(&mut self, applied: Applied<'_>);

    // Provided method
    fn apply_header(&mut self, desired: &Self, existing: Existing) { ... }
}
Expand description

A parsed document whose root node can be edited in place.

Required Associated Types§

Required Methods§

Source

fn header_text(&self) -> &str

The text of the header comment of this document.

Source

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 root(&self) -> &Self::Node

The root node.

Source

fn root_mut(&mut self) -> &mut Self::Node

The root node the merge works on.

Source

fn set_leading(&mut self, applied: Applied<'_>)

Put the leading text of an applied header in place.

Provided Methods§

Source

fn apply_header(&mut self, desired: &Self, existing: Existing)

Replace the leading comment block of this document with the header of desired.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§