Skip to main content

ContentValidatorState

Enum ContentValidatorState 

Source
pub enum ContentValidatorState {
    Nfa {
        nfa: NfaTable,
        active_states: ActiveStates,
        open_content: Option<OpenContentInfo>,
    },
    AllGroup {
        model: AllGroupModel,
        state: AllGroupState,
        suffix_locked: bool,
    },
    AllGroupExtension {
        model: AllGroupModel,
        state: AllGroupState,
        extension_nfa: NfaTable,
        phase: AllGroupExtPhase,
    },
    Simple,
    Empty,
}
Expand description

Unified content model validation state

Wraps either an NFA-based or AllGroup-based content model into a single enum so that SchemaValidator can advance the content model without caring which underlying representation is in use.

Variants§

§

Nfa

NFA-based content model (sequence, choice, etc.)

Fields

§active_states: ActiveStates
§open_content: Option<OpenContentInfo>
§

AllGroup

All-group content model (unordered particles)

Fields

§suffix_locked: bool

true once a suffix open-content element has been matched — further declared all-group particles are no longer accepted (§3.10.4 suffix semantics: declared content first, then wildcard).

§

AllGroupExtension

All-group base + NFA extension (XSD 1.1 complex type extension).

Fields

§extension_nfa: NfaTable
§

Simple

Simple content (text only, no child elements)

§

Empty

Empty content (no children or text)

Implementations§

Source§

impl ContentValidatorState

Source

pub fn from_matcher(matcher: ContentModelMatcher) -> Self

Create a content validator state from a compiled content model matcher

Source

pub fn from_nfa(nfa: NfaTable) -> Self

Create a content validator state from an NFA table

Computes the initial epsilon closure from the start state.

Source

pub fn from_all_group(model: AllGroupModel) -> Self

Create a content validator state from an all-group model

Source

pub fn advance_element( &mut self, name: NameId, namespace: Option<NameId>, target_ns: Option<NameId>, xsd_version: XsdVersion, subst_groups: Option<&SubstitutionGroupMap>, ) -> Option<ElementMatchInfo>

Advance the content model with a child element

Returns None if the element was rejected. Returns Some(ElementMatchInfo) if accepted, containing the ElementKey and resolved_type from the matching NFA term (if any).

Source

pub fn is_complete(&self) -> bool

Check whether the content model is in a complete (accepting) state

For NFA: any active state is the accept state. For AllGroup: all required particles have been satisfied.

Source

pub fn would_accept( &self, name: NameId, namespace: Option<NameId>, target_ns: Option<NameId>, xsd_version: XsdVersion, subst_groups: Option<&SubstitutionGroupMap>, ) -> bool

Non-mutating lookahead: would the given element be accepted?

This does not change the state of the content model.

Trait Implementations§

Source§

impl Clone for ContentValidatorState

Source§

fn clone(&self) -> ContentValidatorState

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 Debug for ContentValidatorState

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> MaybeSendSync for T

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.