[][src]Struct yaml_validator::Context

pub struct Context<'schema> { /* fields omitted */ }

Contains a number of schemas that may or may not be dependent on each other.

Methods

impl<'schema> Context<'schema>[src]

pub fn get_schema(&self, uri: &str) -> Option<&Schema<'schema>>[src]

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

impl<'schema> Debug for Context<'schema>[src]

impl<'schema> Default for Context<'schema>[src]

impl<'schema> TryFrom<&'schema Vec<Yaml>> for Context<'schema>[src]

A context can only be created from a vector of Yaml documents, all of which must fit the schema layout.

type Error = SchemaError<'schema>

The type returned in the event of a conversion error.

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.