Skip to main content

Validation

Struct Validation 

Source
pub struct Validation<'s, 'a> { /* private fields */ }
Expand description

A validation in progress, given the events of a document one by one, in document order, as einvoice_xml::Reader reads them: Schema::validation.

This is what Schema::validate does, for a caller that reads the document itself, so that one pass over the text checks it for well-formedness (and for anything else the caller wants to check) and validates it. The events must be those of a reader of the text given to Schema::validation, every one of them, up to the end of the document: the validation does not check well-formedness, and the positions of its errors are byte offsets of that text. An event of a document the reader then refuses, or a validation finished early, gives a report that means nothing; it never panics.

Implementations§

Source§

impl<'s, 'a> Validation<'s, 'a>

Source

pub fn event(&mut self, event: Event<'_, 'a>)

Takes the next event of the document.

Source

pub fn finish(self) -> Result<Report, DocumentError>

The report, once every event is given.

§Errors

DocumentError::Unsupported when the document needs a feature outside the implemented subset (an xs:ENTITY value in a document with a document type declaration, whose unparsed entities this crate does not read, or a value constraint of a declaration taken as a value of a type valid only in a context): the first such element in document order.

Trait Implementations§

Source§

impl Debug for Validation<'_, '_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'s, 'a> Forget for Validation<'s, 'a>

§

impl<'s, 'a> Freeze for Validation<'s, 'a>

§

impl<'s, 'a> RefUnwindSafe for Validation<'s, 'a>

§

impl<'s, 'a> Send for Validation<'s, 'a>

§

impl<'s, 'a> Sync for Validation<'s, 'a>

§

impl<'s, 'a> Unpin for Validation<'s, 'a>

§

impl<'s, 'a> UnsafeUnpin for Validation<'s, 'a>

§

impl<'s, 'a> UnwindSafe for Validation<'s, '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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.