pub struct NaturalXmlDiff<'a> { /* private fields */ }
Expand description

A natural XML diff comparison of two documents.

Implementations§

Construct a comparison between two XML documents from XML strings.

Examples found in repository?
src/convenience.rs (line 161)
160
161
162
163
pub fn diff(xml_a: &str, xml_b: &str) -> Result<String, Error> {
    let mut nxd = NaturalXmlDiff::new(xml_a, xml_b)?;
    Ok(nxd.diff())
}

Returns a diff document for this comparison.

This diff document contains information on how to change document A into document B. If this diff document is applied using apply, the result should be semantically equivalent to document B.

Examples found in repository?
src/convenience.rs (line 162)
160
161
162
163
pub fn diff(xml_a: &str, xml_b: &str) -> Result<String, Error> {
    let mut nxd = NaturalXmlDiff::new(xml_a, xml_b)?;
    Ok(nxd.diff())
}

Verify that a correct diff gets produced in one step.

This is a convenience function that first constructs the diff document and then immediately applies it to document A and checks that the result is semantically equal to document B. If not, it returns the XML for the erroneous document as part of the error.

It’s useful for testing purposes if you want to ensure that correct diffs are produced.

Returns a list of edits that transform document A into document B.

This is a low-level API to see the details of the edit operations. Normally you’d use the higher level NaturalXmlDiff::diff method to obtain the diff document.

Returns a list of partitions of a and b where nodes are equal.

A low-level API to see the details of the diffing algorithm.

Returns an iterator of nodes in document a and b and their status.

A low-level API to see the details of the diffing algorithm.

Serialize a node to a string.

You can get a node if you access the edits and have an InsertContent::XmlNode

Access to the low-level Xot instance - this is useful if you need access to XML values and names.

Normally should not be needed if you stick to the high-level API.

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 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.