pub struct Node<'a> { /* private fields */ }Expand description
A validator node: the map of options plus what’s needed to read them and recurse.
Passed to each Registry constructor. Custom constructors use its readers
(opt_int, flag, child, …) to pull options and build nested validators.
Implementations§
Source§impl Node<'_>
impl Node<'_>
Sourcepub fn error(&self, kind: SchemaErrorKind) -> SchemaError
pub fn error(&self, kind: SchemaErrorKind) -> SchemaError
Build an error anchored at this node.
Sourcepub fn opt_str(&self, field: &str) -> Result<Option<&str>, SchemaError>
pub fn opt_str(&self, field: &str) -> Result<Option<&str>, SchemaError>
Read an optional string field.
Sourcepub fn opt_int(&self, field: &str) -> Result<Option<isize>, SchemaError>
pub fn opt_int(&self, field: &str) -> Result<Option<isize>, SchemaError>
Read an optional integer field.
Sourcepub fn opt_usize(&self, field: &str) -> Result<Option<usize>, SchemaError>
pub fn opt_usize(&self, field: &str) -> Result<Option<usize>, SchemaError>
Read an optional non-negative integer field as a usize.
Sourcepub fn opt_f64(&self, field: &str) -> Result<Option<f64>, SchemaError>
pub fn opt_f64(&self, field: &str) -> Result<Option<f64>, SchemaError>
Read an optional number field (integer or float) as an f64.
Sourcepub fn opt_bool(&self, field: &str) -> Result<Option<bool>, SchemaError>
pub fn opt_bool(&self, field: &str) -> Result<Option<bool>, SchemaError>
Read an optional boolean field.
Sourcepub fn flag(&self, field: &str) -> Result<bool, SchemaError>
pub fn flag(&self, field: &str) -> Result<bool, SchemaError>
Read a boolean field, defaulting to false when absent.
Sourcepub fn values(&self, field: &str) -> Result<Vec<Value>, SchemaError>
pub fn values(&self, field: &str) -> Result<Vec<Value>, SchemaError>
Read a list field as raw values (used by enum). Absent → empty.
Sourcepub fn str_list(&self, field: &str) -> Result<Vec<String>, SchemaError>
pub fn str_list(&self, field: &str) -> Result<Vec<String>, SchemaError>
Read a list-of-strings field (used by path.extensions, url.schemes). Absent → empty.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Node<'a>
impl<'a> !Send for Node<'a>
impl<'a> !Sync for Node<'a>
impl<'a> !UnwindSafe for Node<'a>
impl<'a> Freeze for Node<'a>
impl<'a> Unpin for Node<'a>
impl<'a> UnsafeUnpin for Node<'a>
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