pub struct Validator { /* private fields */ }Expand description
A compiled schema. Cheap to clone and safe to share between threads.
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn is_valid(&self, instance: &Value) -> bool
pub fn is_valid(&self, instance: &Value) -> bool
Whether the instance is valid. A schema that recursed in place beyond the maximum depth is reported as
invalid; use Validator::validate to tell the two apart.
Sourcepub fn validate(
&self,
instance: &Value,
) -> Result<bool, SchemaEvaluationDepthError>
pub fn validate( &self, instance: &Value, ) -> Result<bool, SchemaEvaluationDepthError>
Whether the instance is valid, or an error if evaluation recursed in place beyond the maximum depth.
Sourcepub fn evaluate(
&self,
instance: &Value,
collector: &mut JsonSchemaResultsCollector,
) -> Result<bool, SchemaEvaluationDepthError>
pub fn evaluate( &self, instance: &Value, collector: &mut JsonSchemaResultsCollector, ) -> Result<bool, SchemaEvaluationDepthError>
Evaluates the instance exhaustively, reporting to the collector. Returns whether it is valid.
Sourcepub fn validate_instance<'a, I: Instance<'a>>(
&self,
instance: I,
) -> Result<bool, SchemaEvaluationDepthError>
pub fn validate_instance<'a, I: Instance<'a>>( &self, instance: I, ) -> Result<bool, SchemaEvaluationDepthError>
Validator::validate for any Instance: a value read in place, such as a host language’s own objects,
with no conversion to serde_json::Value.
Sourcepub fn evaluate_instance<'a, I: Instance<'a>>(
&self,
instance: I,
collector: &mut JsonSchemaResultsCollector,
) -> Result<bool, SchemaEvaluationDepthError>
pub fn evaluate_instance<'a, I: Instance<'a>>( &self, instance: I, collector: &mut JsonSchemaResultsCollector, ) -> Result<bool, SchemaEvaluationDepthError>
Validator::evaluate for any Instance.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Validator
impl !UnwindSafe for Validator
impl Freeze for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnsafeUnpin 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