ValidationState

Struct ValidationState 

Source
pub struct ValidationState {
    pub path: EurePath,
    pub has_holes: bool,
    pub errors: Vec<ValidationError>,
    pub warnings: Vec<ValidationWarning>,
    /* private fields */
}
Expand description

Internal mutable state during validation.

Wrapped in RefCell to allow interior mutability through shared references.

Fields§

§path: EurePath

Current path in the document (for error reporting)

§has_holes: bool

Whether any holes have been encountered

§errors: Vec<ValidationError>

Accumulated validation errors

§warnings: Vec<ValidationWarning>

Accumulated warnings

Implementations§

Source§

impl ValidationState

Source

pub fn new() -> Self

Source

pub fn record_error(&mut self, error: ValidationError)

Record an error (validation continues).

Source

pub fn record_warning(&mut self, warning: ValidationWarning)

Record a warning.

Source

pub fn mark_has_holes(&mut self)

Mark that a hole was encountered.

Source

pub fn has_errors(&self) -> bool

Check if any errors have been recorded.

Source

pub fn error_count(&self) -> usize

Get the number of errors.

Source

pub fn push_path_ident(&mut self, ident: Identifier)

Push an identifier to the path.

Source

pub fn push_path_key(&mut self, key: ObjectKey)

Push a key to the path.

Source

pub fn push_path_index(&mut self, index: usize)

Push an array index to the path.

Source

pub fn push_path_tuple_index(&mut self, index: u8)

Push a tuple index to the path.

Source

pub fn push_path_extension(&mut self, ident: Identifier)

Push an extension to the path.

Source

pub fn pop_path(&mut self)

Pop the last segment from the path.

Source

pub fn fork(&self) -> Self

Clone for fork (trial validation).

Source

pub fn merge(&mut self, other: Self)

Merge results from a forked state.

Source

pub fn finish(self) -> ValidationOutput

Consume and produce final output.

Source

pub fn record_variant_errors( &mut self, variant_name: String, errors: Vec<ValidationError>, )

Record variant attempt errors (for union validation).

Source

pub fn take_variant_errors(&mut self) -> Vec<(String, Vec<ValidationError>)>

Take collected variant errors (for union error construction).

Source

pub fn clear_variant_errors(&mut self)

Clear variant errors without taking (for successful variant match).

Trait Implementations§

Source§

impl Debug for ValidationState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ValidationState

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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.