pub struct Schema { /* private fields */ }Expand description
Schema for validating configuration
Implementations§
Source§impl Schema
impl Schema
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
Load a schema from a file (JSON or YAML based on extension)
Sourcepub fn validate(&self, value: &Value) -> Result<()>
pub fn validate(&self, value: &Value) -> Result<()>
Validate a Value against this schema
Returns Ok(()) if valid, or an error with details about the first validation failure.
Sourcepub fn validate_collect(&self, value: &Value) -> Vec<ValidationError>
pub fn validate_collect(&self, value: &Value) -> Vec<ValidationError>
Validate and collect all errors (instead of failing on first)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Schema
impl !RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl !UnwindSafe for Schema
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