pub struct Validator { /* private fields */ }Expand description
YAML 1.2 specification validator
Performs strict validation checks on parsed YAML documents. The parser itself is lenient and focuses on error recovery, while this validator enforces strict spec compliance.
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn with_config(config: ValidatorConfig) -> Self
pub fn with_config(config: ValidatorConfig) -> Self
Create a validator with custom configuration
Sourcepub fn validate(&self, doc: &Document) -> Vec<Violation>
pub fn validate(&self, doc: &Document) -> Vec<Violation>
Validate a YAML document against YAML 1.2 spec
Returns a list of spec violations. Empty list means strictly compliant.
Sourcepub fn validate_syntax(&self, node: &SyntaxNode<Lang>) -> Vec<Violation>
pub fn validate_syntax(&self, node: &SyntaxNode<Lang>) -> Vec<Violation>
Validate from a syntax node (can be ROOT, DOCUMENT, or any node)
This is useful when you need to validate the full parse tree including directives that may not be attached to a specific document.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Validator
impl RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnsafeUnpin for Validator
impl UnwindSafe for Validator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more