Skip to main content

Schema

Trait Schema 

Source
pub trait Schema {
    type Input;
    type Output;

    // Required method
    fn parse(&self, input: &Self::Input) -> Result<Self::Output, FormaError>;
}
Expand description

The typed validation view.

Err always carries at least one issue. v0 primitives set Input == Output; crate::coerce::CoercedSchema is the first transform-shaped citizen (Input = String, Output = T), and crate::types::object::ObjectSchema makes the ordered crate::value::Object the struct-shaped currency (Input = Object, Output = Object).

Required Associated Types§

Source

type Input

What the schema consumes.

Source

type Output

What the schema produces on success.

Required Methods§

Source

fn parse(&self, input: &Self::Input) -> Result<Self::Output, FormaError>

Validates and parses input; all violated constraints accumulate into one error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§