Struct jtd::ValidateOptions[][src]

pub struct ValidateOptions { /* fields omitted */ }

Options you can pass to validate().

Implementations

impl ValidateOptions[src]

pub fn new() -> Self[src]

Construct a new set of options with all default values.

Equivalent to Default::default() or calling with_max_depth(0) and with_max_errors(0).

pub fn with_max_depth(mut self: Self, max_depth: usize) -> Self[src]

Sets the maximum "depth" of references to following in validate().

This option exists to handle the possibility of an infinite loop in a schema. For instance, this is a valid schema:

{ "ref": "loop", "definitions": { "loop": { "ref": "loop" }}}

There are good reasons to sometimes have self-referential schemas -- for instance, to describe a recursive data structure. What with_max_depth does is limit how many recursive ref nodes will be followed before validate() errors with ValidateError::MaxDepthExceeded.

The default max depth of 0 indicates that no max depth should be implemented. An infinite ref loop will eventually overflow the stack during validate().

pub fn with_max_errors(mut self: Self, max_errors: usize) -> Self[src]

Sets the maximum number of validation errors to return from validate().

This option exists as an optimization for validate(). If all you care about is whether an input is valid, then consider using set_max_errors(1) to have validate() immediately return after finding a validation error.

The default max errors of 0 indicates that all errors will be returned.

Trait Implementations

impl Clone for ValidateOptions[src]

impl Debug for ValidateOptions[src]

impl Default for ValidateOptions[src]

impl Eq for ValidateOptions[src]

impl PartialEq<ValidateOptions> for ValidateOptions[src]

impl StructuralEq for ValidateOptions[src]

impl StructuralPartialEq for ValidateOptions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.