pub enum EditTree<T> {
    MatchNode {
        pre: usize,
        suf: usize,
        left: Option<Box<EditTree<T>>>,
        right: Option<Box<EditTree<T>>>,
    },
    ReplaceNode {
        replacee: Vec<T>,
        replacement: Vec<T>,
    },
}
Expand description

Enum representing either a EditTree::MatchNode with a prefix and suffix length or a EditTree::ReplaceNode describing a replace operation.

Variants

MatchNode

Fields

pre: usize
suf: usize
left: Option<Box<EditTree<T>>>
right: Option<Box<EditTree<T>>>

ReplaceNode

Fields

replacee: Vec<T>
replacement: Vec<T>

Implementations

Returns a edit tree specifying how to derive b from a.

Caution: when using with stringy types. UTF-8 multi byte chars will not be treated well. Consider passing in &char instead.

Returns a s-String representation of the EditTree.

format_vec defines how to transform the Vec<T> of a ReplaceNode into a String. This is useful when implementing Display for your own types where conversion to String may not be straight forward.

Trait Implementations

Recursively applies the nodes stored in the edit tree. Returns None if the tree is not applicable to form.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.