Struct jtd::ValidateOptions [−][src]
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]
fn clone(&self) -> ValidateOptions
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ValidateOptions
[src]
impl Default for ValidateOptions
[src]
fn default() -> ValidateOptions
[src]
impl Eq for ValidateOptions
[src]
impl PartialEq<ValidateOptions> for ValidateOptions
[src]
fn eq(&self, other: &ValidateOptions) -> bool
[src]
fn ne(&self, other: &ValidateOptions) -> bool
[src]
impl StructuralEq for ValidateOptions
[src]
impl StructuralPartialEq for ValidateOptions
[src]
Auto Trait Implementations
impl RefUnwindSafe for ValidateOptions
[src]
impl Send for ValidateOptions
[src]
impl Sync for ValidateOptions
[src]
impl Unpin for ValidateOptions
[src]
impl UnwindSafe for ValidateOptions
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,