pub struct Validator { /* private fields */ }
Expand description
A structure for validating STAC.
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn new() -> Result<Validator>
pub fn new() -> Result<Validator>
Creates a new validator.
§Examples
use stac_validate::Validator;
let validator = Validator::new().unwrap();
Sourcepub fn validate<T>(&mut self, value: &T) -> Result<()>where
T: Serialize,
pub fn validate<T>(&mut self, value: &T) -> Result<()>where
T: Serialize,
Validates a single value.
§Examples
use stac::Item;
use stac_validate::Validator;
let item = Item::new("an-id");
let mut validator = Validator::new().unwrap();
validator.validate(&item).unwrap();
Sourcepub fn validate_value(&mut self, value: Value) -> Result<Value>
pub fn validate_value(&mut self, value: Value) -> Result<Value>
If you have a serde_json::Value, you can skip a deserialization step by using this method.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Validator
impl !RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl !UnwindSafe for Validator
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