pub struct Context<'schema> { /* private fields */ }Expand description
Contains a number of schemas that may or may not be dependent on each other.
Implementations§
Source§impl<'schema> Context<'schema>
impl<'schema> Context<'schema>
Sourcepub fn get_schema(&self, uri: &str) -> Option<&Schema<'schema>>
pub fn get_schema(&self, uri: &str) -> Option<&Schema<'schema>>
Get a reference to a single schema within the context to use for validation.
§Examples
let schemas = vec![
YamlLoader::load_from_str(r#"
uri: just-a-number
schema:
type: integer
"#).unwrap().remove(0)
];
let context = Context::try_from(&schemas[..]).unwrap();
let document = YamlLoader::load_from_str("10").unwrap().remove(0);
context.get_schema("just-a-number").unwrap()
.validate(&context, &document).unwrap();Trait Implementations§
Auto Trait Implementations§
impl<'schema> Freeze for Context<'schema>
impl<'schema> RefUnwindSafe for Context<'schema>
impl<'schema> Send for Context<'schema>
impl<'schema> Sync for Context<'schema>
impl<'schema> Unpin for Context<'schema>
impl<'schema> UnwindSafe for Context<'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