pub struct AdfDocument<'a> { /* private fields */ }Expand description
Parsed ADF document plus original-input preservation state.
Mutating through AdfDocument::prospect_mut marks a single prospect dirty
so original-preserving writes can replace only that byte span. Mutating
through AdfDocument::adf_mut marks the whole document dirty and causes
original-preserving writes to fall back to normalized typed output.
Implementations§
Source§impl<'a> AdfDocument<'a>
impl<'a> AdfDocument<'a>
Sourcepub fn root(&self) -> &XmlElement<'a>
pub fn root(&self) -> &XmlElement<'a>
Return the raw XML root, reparsing the original input on first access.
The typed model is built eagerly by crate::parse, but the full raw
tree is kept lazy so callers that only need typed ADF fields avoid
retaining two complete document representations.
Sourcepub fn adf_mut(&mut self) -> &mut Adf<'a>
pub fn adf_mut(&mut self) -> &mut Adf<'a>
Mutably access the typed ADF model and mark the whole document dirty.
Sourcepub fn prospect_mut(&mut self, index: usize) -> Option<&mut Prospect<'a>>
pub fn prospect_mut(&mut self, index: usize) -> Option<&mut Prospect<'a>>
Mutably access one prospect and mark only that prospect dirty.
Sourcepub fn validate(&self) -> ValidationReport<'a>
pub fn validate(&self) -> ValidationReport<'a>
Validate the typed ADF model using lenient default options.
Sourcepub fn validate_strict(&self) -> ValidationReport<'a>
pub fn validate_strict(&self) -> ValidationReport<'a>
Validate the typed ADF model with strict structural requirements.
Strict mode promotes missing required structure to errors. Enum and lightweight format issues remain warnings.
Sourcepub fn write_original_preserving<W: Write>(&self, writer: W) -> Result<()>
pub fn write_original_preserving<W: Write>(&self, writer: W) -> Result<()>
Write XML while preserving unchanged original input where possible.
Sourcepub fn write_typed<W: Write>(&self, writer: W) -> Result<()>
pub fn write_typed<W: Write>(&self, writer: W) -> Result<()>
Write normalized XML from the typed ADF model.
Non-element extension nodes are preserved, but only element extensions carry source spans for relative ordering around typed children.
Sourcepub fn to_original_preserving_string(&self) -> Result<String>
pub fn to_original_preserving_string(&self) -> Result<String>
Return AdfDocument::write_original_preserving output as a string.
Sourcepub fn to_typed_string(&self) -> Result<String>
pub fn to_typed_string(&self) -> Result<String>
Return AdfDocument::write_typed output as a string.
Trait Implementations§
Source§impl<'a> Clone for AdfDocument<'a>
impl<'a> Clone for AdfDocument<'a>
Source§fn clone(&self) -> AdfDocument<'a>
fn clone(&self) -> AdfDocument<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more