Skip to main content

include_validator

Macro include_validator 

Source
macro_rules! include_validator {
    ($(#[$attr:meta])* $vis:vis $name:ident) => { ... };
}
Expand description

Declares the validation module a build script generated for a schema: include_validator!(pub invoice) is pub mod invoice, its contents read from $OUT_DIR/invoice.rs, which codegen::Configuration with .module("invoice") wrote (feature codegen of the build dependency). Attributes and doc comments before the visibility go to the module.

The module has three functions: check(&[u8], &mut Scratch) -> Verdict (the tables alone), validate(&[u8]) -> Result<(), ValidateError> (the tables, then the dynamic validator) and with_schema_set(|set| …) (the set validate falls back to). The plan module says what they answer.

The build dependency and the dependency must be the same version of this crate: a module written by another version does not compile, with a message that says so. The dependency needs plan, and xsd11 only for an XSD 1.1 module; an XSD 1.0 module compiles with or without it.