pub enum ValidatorState {
None,
Start,
Element,
Attribute,
EndOfAttributes,
Text,
Whitespace,
EndElement,
Finish,
}Expand description
State machine for the validator’s call sequence
Enforces that push-API methods are called in the correct order. The valid transitions are:
None → Start → Element → Attribute* → EndOfAttributes → (Text|Whitespace)* → EndElement → ... → Finish
↑ |
└── (Element cycle) ────┘Variants§
None
Initial state, no validation has started
Start
validate_element has been called for the root element
Element
Inside an element (after validate_element)
Attribute
Processing attributes (after validate_attribute)
EndOfAttributes
After validate_end_of_attributes
Text
After validate_text
Whitespace
After validate_whitespace
EndElement
After validate_end_element
Finish
After end_validation — no further calls allowed
Implementations§
Source§impl ValidatorState
impl ValidatorState
Sourcepub fn can_start_element(&self) -> bool
pub fn can_start_element(&self) -> bool
Check if validate_element can be called in this state
Sourcepub fn can_validate_attribute(&self) -> bool
pub fn can_validate_attribute(&self) -> bool
Check if validate_attribute can be called in this state
Sourcepub fn can_end_attributes(&self) -> bool
pub fn can_end_attributes(&self) -> bool
Check if validate_end_of_attributes can be called in this state
Sourcepub fn can_validate_text(&self) -> bool
pub fn can_validate_text(&self) -> bool
Check if validate_text / validate_whitespace can be called in this state
Sourcepub fn can_end_element(&self) -> bool
pub fn can_end_element(&self) -> bool
Check if validate_end_element can be called in this state
Sourcepub fn can_finish(&self) -> bool
pub fn can_finish(&self) -> bool
Check if end_validation can be called in this state
Trait Implementations§
Source§impl Clone for ValidatorState
impl Clone for ValidatorState
Source§fn clone(&self) -> ValidatorState
fn clone(&self) -> ValidatorState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ValidatorState
Source§impl Debug for ValidatorState
impl Debug for ValidatorState
impl Eq for ValidatorState
Source§impl PartialEq for ValidatorState
impl PartialEq for ValidatorState
Source§fn eq(&self, other: &ValidatorState) -> bool
fn eq(&self, other: &ValidatorState) -> bool
self and other values to be equal, and is used by ==.