pub trait Validate {
    // Required method
    fn validate_impl(&self, ctx: &mut ValidationCtx);

    // Provided method
    fn validate(&self) -> Result<(), ValidationReport> { ... }
}
Expand description

Pre-compilation validation of tables.

The OpenType specification describes various requirements for different tables that are awkward to encode in the type system, such as requiring certain arrays to have equal lengths. These requirements are enforced via a validation pass.

Required Methods§

source

fn validate_impl(&self, ctx: &mut ValidationCtx)

Validate this table.

If you need to implement this directly, it should look something like:

struct MyRecord {
    my_values: Vec<u16>,
}

impl Validate for MyRecord {
    fn validate_impl(&self, ctx: &mut ValidationCtx) {
        ctx.in_table("MyRecord", |ctx| {
            ctx.in_field("my_values", |ctx| {
                if self.my_values.len() > (u16::MAX as usize) {
                    ctx.report("array is too long");
                }
            })
        })
    }
}

Provided Methods§

source

fn validate(&self) -> Result<(), ValidationReport>

Ensure that this table is well-formed, reporting any errors.

This is an auto-generated method that calls to validate_impl and collects any errors.

Implementations on Foreign Types§

source§

impl<T: Validate> Validate for Option<T>

source§

impl<T: Validate> Validate for BTreeSet<T>

source§

impl<T: Validate> Validate for Vec<T>

Implementors§

source§

impl Validate for BaseCoord

source§

impl Validate for CmapSubtable

source§

impl Validate for CaretValue

source§

impl Validate for Glyph

source§

impl Validate for AnchorTable

source§

impl Validate for write_fonts::tables::gpos::ExtensionSubtable

source§

impl Validate for PairPos

source§

impl Validate for PositionLookup

source§

impl Validate for SinglePos

source§

impl Validate for write_fonts::tables::gsub::ExtensionSubtable

source§

impl Validate for SingleSubst

source§

impl Validate for SubstitutionLookup

source§

impl Validate for ChainedSequenceContext

source§

impl Validate for ClassDef

source§

impl Validate for CoverageTable

source§

impl Validate for DeviceOrVariationIndex

source§

impl Validate for FeatureParams

source§

impl Validate for SequenceContext

source§

impl Validate for AxisValue

source§

impl Validate for DeltaSetIndexMap

source§

impl Validate for PackedPointNumbers

source§

impl Validate for Avar

source§

impl Validate for AxisValueMap

source§

impl Validate for SegmentMaps

source§

impl Validate for Axis

source§

impl Validate for Base

source§

impl Validate for BaseCoordFormat1

source§

impl Validate for BaseCoordFormat2

source§

impl Validate for BaseCoordFormat3

source§

impl Validate for BaseLangSysRecord

source§

impl Validate for BaseScript

source§

impl Validate for BaseScriptList

source§

impl Validate for BaseScriptRecord

source§

impl Validate for BaseTagList

source§

impl Validate for BaseValues

source§

impl Validate for FeatMinMaxRecord

source§

impl Validate for MinMax

source§

impl Validate for Cmap0

source§

impl Validate for Cmap2

source§

impl Validate for Cmap4

source§

impl Validate for Cmap6

source§

impl Validate for Cmap8

source§

impl Validate for Cmap10

source§

impl Validate for Cmap12

source§

impl Validate for Cmap13

source§

impl Validate for Cmap14

source§

impl Validate for Cmap

source§

impl Validate for ConstantMapGroup

source§

impl Validate for DefaultUvs

source§

impl Validate for EncodingRecord

source§

impl Validate for NonDefaultUvs

source§

impl Validate for SequentialMapGroup

source§

impl Validate for SubHeader

source§

impl Validate for UnicodeRange

source§

impl Validate for UvsMapping

source§

impl Validate for VariationSelector

source§

impl Validate for AxisInstanceArrays

source§

impl Validate for Fvar

source§

impl Validate for InstanceRecord

source§

impl Validate for VariationAxisRecord

source§

impl Validate for AttachList

source§

impl Validate for AttachPoint

source§

impl Validate for CaretValueFormat1

source§

impl Validate for CaretValueFormat2

source§

impl Validate for CaretValueFormat3

source§

impl Validate for Gdef

source§

impl Validate for LigCaretList

source§

impl Validate for LigGlyph

source§

impl Validate for MarkGlyphSets

source§

impl Validate for CompositeGlyph

source§

impl Validate for Glyf

source§

impl Validate for SimpleGlyph

source§

impl Validate for AnchorFormat1

source§

impl Validate for AnchorFormat2

source§

impl Validate for AnchorFormat3

source§

impl Validate for BaseArray

source§

impl Validate for BaseRecord

source§

impl Validate for Class1Record

source§

impl Validate for Class2Record

source§

impl Validate for ComponentRecord

source§

impl Validate for CursivePosFormat1

source§

impl Validate for EntryExitRecord

source§

impl Validate for Gpos

source§

impl Validate for LigatureArray

source§

impl Validate for LigatureAttach

source§

impl Validate for Mark2Array

source§

impl Validate for Mark2Record

source§

impl Validate for MarkArray

source§

impl Validate for MarkBasePosFormat1

source§

impl Validate for MarkLigPosFormat1

source§

impl Validate for MarkMarkPosFormat1

source§

impl Validate for MarkRecord

source§

impl Validate for PairPosFormat1

source§

impl Validate for PairPosFormat2

source§

impl Validate for PairSet

source§

impl Validate for PairValueRecord

source§

impl Validate for PositionChainContext

source§

impl Validate for PositionSequenceContext

source§

impl Validate for SinglePosFormat1

source§

impl Validate for SinglePosFormat2

source§

impl Validate for write_fonts::tables::gpos::ValueRecord

source§

impl Validate for AlternateSet

source§

impl Validate for AlternateSubstFormat1

source§

impl Validate for Gsub

source§

impl Validate for Ligature

source§

impl Validate for LigatureSet

source§

impl Validate for LigatureSubstFormat1

source§

impl Validate for MultipleSubstFormat1

source§

impl Validate for ReverseChainSingleSubstFormat1

source§

impl Validate for Sequence

source§

impl Validate for SingleSubstFormat1

source§

impl Validate for SingleSubstFormat2

source§

impl Validate for SubstitutionChainContext

source§

impl Validate for SubstitutionSequenceContext

source§

impl Validate for GlyphVariationData

source§

impl Validate for GlyphVariationDataHeader

source§

impl Validate for Gvar

source§

impl Validate for SharedTuples

source§

impl Validate for Head

source§

impl Validate for Hhea

source§

impl Validate for Hmtx

source§

impl Validate for LongMetric

source§

impl Validate for Hvar

source§

impl Validate for ChainedClassSequenceRule

source§

impl Validate for ChainedClassSequenceRuleSet

source§

impl Validate for ChainedSequenceContextFormat1

source§

impl Validate for ChainedSequenceContextFormat2

source§

impl Validate for ChainedSequenceContextFormat3

source§

impl Validate for ChainedSequenceRule

source§

impl Validate for ChainedSequenceRuleSet

source§

impl Validate for CharacterVariantParams

source§

impl Validate for ClassDefFormat1

source§

impl Validate for ClassDefFormat2

source§

impl Validate for ClassRangeRecord

source§

impl Validate for ClassSequenceRule

source§

impl Validate for ClassSequenceRuleSet

source§

impl Validate for ConditionFormat1

source§

impl Validate for ConditionSet

source§

impl Validate for CoverageFormat1

source§

impl Validate for CoverageFormat2

source§

impl Validate for Device

source§

impl Validate for Feature

source§

impl Validate for FeatureList

source§

impl Validate for FeatureRecord

source§

impl Validate for FeatureTableSubstitution

source§

impl Validate for FeatureTableSubstitutionRecord

source§

impl Validate for FeatureVariationRecord

source§

impl Validate for FeatureVariations

source§

impl Validate for LangSys

source§

impl Validate for LangSysRecord

source§

impl Validate for PendingVariationIndex

source§

impl Validate for RangeRecord

source§

impl Validate for Script

source§

impl Validate for ScriptList

source§

impl Validate for ScriptRecord

source§

impl Validate for SequenceContextFormat1

source§

impl Validate for SequenceContextFormat2

source§

impl Validate for SequenceContextFormat3

source§

impl Validate for SequenceLookupRecord

source§

impl Validate for SequenceRule

source§

impl Validate for SequenceRuleSet

source§

impl Validate for SizeParams

source§

impl Validate for StylisticSetParams

source§

impl Validate for VariationIndex

source§

impl Validate for Loca

source§

impl Validate for Maxp

source§

impl Validate for Mvar

source§

impl Validate for write_fonts::tables::mvar::ValueRecord

source§

impl Validate for LangTagRecord

source§

impl Validate for Name

source§

impl Validate for NameRecord

source§

impl Validate for Os2

source§

impl Validate for Post

source§

impl Validate for GlyphData

source§

impl Validate for Sbix

source§

impl Validate for Strike

source§

impl Validate for AxisRecord

source§

impl Validate for AxisValueArray

source§

impl Validate for AxisValueFormat1

source§

impl Validate for AxisValueFormat2

source§

impl Validate for AxisValueFormat3

source§

impl Validate for AxisValueFormat4

source§

impl Validate for AxisValueRecord

source§

impl Validate for Stat

source§

impl Validate for DeltaSetIndexMapFormat0

source§

impl Validate for DeltaSetIndexMapFormat1

source§

impl Validate for ItemVariationData

source§

impl Validate for ItemVariationStore

source§

impl Validate for PackedDeltas

source§

impl Validate for RegionAxisCoordinates

source§

impl Validate for Tuple

source§

impl Validate for TupleVariationHeader

source§

impl Validate for VariationRegion

source§

impl Validate for VariationRegionList

source§

impl Validate for Vhea

source§

impl Validate for Vmtx

source§

impl<T: Validate> Validate for ExtensionPosFormat1<T>

source§

impl<T: Validate> Validate for ExtensionSubstFormat1<T>

source§

impl<T: Validate> Validate for Lookup<T>

source§

impl<T: Validate> Validate for LookupList<T>

source§

impl<const N: usize, T: Validate> Validate for NullableOffsetMarker<T, N>

source§

impl<const N: usize, T: Validate> Validate for OffsetMarker<T, N>