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§
source§impl 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§
source§impl Clone for ValidationCtx
impl Clone for ValidationCtx
source§fn clone(&self) -> ValidationCtx
fn clone(&self) -> ValidationCtx
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ValidationCtx
impl Debug for ValidationCtx
source§impl Default for ValidationCtx
impl Default for ValidationCtx
source§fn 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§
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
source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere U: FromObjRef<T>,
source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.