pub trait Validate: Serialize + Sized {
// Provided method
fn validate(&self) -> Result<()> { ... }
}
Expand description
Validate any serializable object with json-schema
Provided Methods§
Sourcefn validate(&self) -> Result<()>
fn validate(&self) -> Result<()>
Validates this object.
If the object fails validation, this will return an Error::Validation which contains a vector of all of the validation errors.
If you’re doing multiple validations, use Validator::validate, which will re-use cached schemas.
§Examples
use stac::Item;
use stac_validate::Validate;
let mut item = Item::new("an-id");
item.validate().unwrap();
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.