Skip to main content

AdfDocument

Struct AdfDocument 

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

Source

pub fn original(&self) -> &'a str

Return the exact XML input used to create this document.

Source

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.

Source

pub fn adf(&self) -> &Adf<'a>

Return the typed ADF model.

Source

pub fn adf_mut(&mut self) -> &mut Adf<'a>

Mutably access the typed ADF model and mark the whole document dirty.

Source

pub fn prospect_mut(&mut self, index: usize) -> Option<&mut Prospect<'a>>

Mutably access one prospect and mark only that prospect dirty.

Source

pub fn is_dirty(&self) -> bool

Return whether any mutation path has marked the document dirty.

Source

pub fn validate(&self) -> ValidationReport<'a>

Validate the typed ADF model using lenient default options.

Source

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.

Source

pub fn write_original_preserving<W: Write>(&self, writer: W) -> Result<()>

Write XML while preserving unchanged original input where possible.

Source

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.

Source

pub fn to_original_preserving_string(&self) -> Result<String>

Return AdfDocument::write_original_preserving output as a string.

Source

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>

Source§

fn clone(&self) -> AdfDocument<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for AdfDocument<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for AdfDocument<'a>

§

impl<'a> !RefUnwindSafe for AdfDocument<'a>

§

impl<'a> !Sync for AdfDocument<'a>

§

impl<'a> Send for AdfDocument<'a>

§

impl<'a> Unpin for AdfDocument<'a>

§

impl<'a> UnsafeUnpin for AdfDocument<'a>

§

impl<'a> UnwindSafe for AdfDocument<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more