pub struct Context<'r> {
pub root_schema: Option<&'r RootSchema>,
pub current_schema: Option<Rc<YamlSchema>>,
pub current_path: Vec<String>,
pub stream_started: bool,
pub stream_ended: bool,
pub errors: Rc<RefCell<Vec<ValidationError>>>,
pub fail_fast: bool,
}Expand description
The validation context
Fields§
§root_schema: Option<&'r RootSchema>We use an Option here so tests can be run without a root schema
current_schema: Option<Rc<YamlSchema>>§current_path: Vec<String>§stream_started: bool§stream_ended: bool§errors: Rc<RefCell<Vec<ValidationError>>>§fail_fast: boolImplementations§
Source§impl<'r> Context<'r>
impl<'r> Context<'r>
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Returns true if there are any errors in the context
pub fn new(fail_fast: bool) -> Context<'r>
pub fn get_sub_context(&self) -> Context<'r>
pub fn with_root_schema( root_schema: &'r RootSchema, fail_fast: bool, ) -> Context<'r>
pub fn add_doc_error<V: Into<String>>(&self, error: V)
Sourcepub fn add_error<V: Into<String>>(&self, marked_yaml: &MarkedYaml<'_>, error: V)
pub fn add_error<V: Into<String>>(&self, marked_yaml: &MarkedYaml<'_>, error: V)
Adds an error message to the current context, with the current path and with location marker
Sourcepub fn extend_errors(&self, errors: Vec<ValidationError>)
pub fn extend_errors(&self, errors: Vec<ValidationError>)
Appends all the errors to the current context
Sourcepub fn append_path<V: Into<String>>(&self, path: V) -> Context<'r>
pub fn append_path<V: Into<String>>(&self, path: V) -> Context<'r>
Append a path to the current path
Trait Implementations§
Auto Trait Implementations§
impl<'r> Freeze for Context<'r>
impl<'r> !RefUnwindSafe for Context<'r>
impl<'r> !Send for Context<'r>
impl<'r> !Sync for Context<'r>
impl<'r> Unpin for Context<'r>
impl<'r> !UnwindSafe for Context<'r>
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