Struct write_fonts::validate::ValidationCtx
source · [−]pub struct ValidationCtx { /* private fields */ }Expand description
A context for collecting validation error.
This is responsible for tracking the position in the tree at which a given error is reported.
paths/locations
As validation travels down through the object graph, the path is recorded via appropriate calls to methods like in_table and in_field.
Implementations
sourceimpl ValidationCtx
impl ValidationCtx
sourcepub fn in_table(&mut self, name: &'static str, f: impl FnOnce(&mut ValidationCtx))
pub fn in_table(&mut self, name: &'static str, f: impl FnOnce(&mut ValidationCtx))
Run the provided closer in the context of a new table.
Errors reported in the closure will include the provided identifer in their path.
sourcepub fn in_field(&mut self, name: &'static str, f: impl FnOnce(&mut ValidationCtx))
pub fn in_field(&mut self, name: &'static str, f: impl FnOnce(&mut ValidationCtx))
Run the provided closer in the context of a new field.
Errors reported in the closure will be associated with the field.
sourcepub fn in_array(&mut self, f: impl FnOnce(&mut ValidationCtx))
pub fn in_array(&mut self, f: impl FnOnce(&mut ValidationCtx))
Run the provided closer in the context of an array.
sourcepub fn array_item(&mut self, f: impl FnOnce(&mut ValidationCtx))
pub fn array_item(&mut self, f: impl FnOnce(&mut ValidationCtx))
Run the provided closer in the context of a new array item.
This must only be called in a closure passed to in_array.
Trait Implementations
sourceimpl Clone for ValidationCtx
impl Clone for ValidationCtx
sourcefn clone(&self) -> ValidationCtx
fn clone(&self) -> ValidationCtx
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for ValidationCtx
impl Debug for ValidationCtx
sourceimpl Default for ValidationCtx
impl Default for ValidationCtx
sourcefn default() -> ValidationCtx
fn default() -> ValidationCtx
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for ValidationCtx
impl Send for ValidationCtx
impl Sync for ValidationCtx
impl Unpin for ValidationCtx
impl UnwindSafe for ValidationCtx
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more