Skip to main content

DynSchema

Trait DynSchema 

Source
pub trait DynSchema: Send + Sync {
    // Required methods
    fn validate_value(&self, v: &Value) -> Vec<FormaIssue>;
    fn shape(&self) -> &ShapeNode;
    fn metadata(&self) -> &FieldMeta;
}
Expand description

The object-safe erased view over a Value tree (DV-2).

Both views execute from the same internal representation, so results always agree with the typed path (SC-9). Usable as Box<dyn DynSchema>.

The Send + Sync supertraits make erased schemas thread-safe and safe to hold in reactive/memo contexts (Arc<Box<dyn DynSchema>> captured by shared closures), so introspection can be cached across threads.

Required Methods§

Source

fn validate_value(&self, v: &Value) -> Vec<FormaIssue>

Validates an erased value; issues mirror what the typed parse would report.

Source

fn shape(&self) -> &ShapeNode

Introspection node describing this schema’s kind and constraints, memoized in a per-instance cache on first call.

Source

fn metadata(&self) -> &FieldMeta

UI-facing metadata slots attached to this schema.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§