Skip to main content

Model

Trait Model 

Source
pub trait Model: JsonType {
Show 18 methods // Provided methods fn parse_json(input: &str) -> Result<Self, ValidationErrors> { ... } fn parse_slice(input: &[u8]) -> Result<Self, ValidationErrors> { ... } fn parse_raw(raw: &RawValue) -> Result<Self, ValidationErrors> { ... } fn parse_value(value: Value) -> Result<Self, ValidationErrors> { ... } fn validate(&self) -> Result<(), ValidationErrors> { ... } fn dump(&self) -> Result<Value, ValidationErrors> { ... } fn dump_json(&self) -> Result<String, ValidationErrors> { ... } fn json_schema(mode: SchemaMode) -> Value { ... } fn schema_report(mode: SchemaMode) -> SchemaReport { ... } fn parse_reader<R: Read>(reader: R) -> Result<Self, ValidationErrors> { ... } fn parse_json_async( input: &str, ) -> impl Future<Output = Result<Self, ValidationErrors>> + Send where Self: AsyncCheck + Send { ... } fn parse_raw_async( raw: &RawValue, ) -> impl Future<Output = Result<Self, ValidationErrors>> + Send where Self: AsyncCheck + Send { ... } fn parse_value_async( value: Value, ) -> impl Future<Output = Result<Self, ValidationErrors>> + Send where Self: AsyncCheck + Send { ... } fn validate_async( &self, ) -> impl Future<Output = Result<(), ValidationErrors>> + Send where Self: AsyncCheck { ... } fn dump_async( &self, ) -> impl Future<Output = Result<Value, ValidationErrors>> + Send where Self: AsyncCheck { ... } fn dump_json_async( &self, ) -> impl Future<Output = Result<String, ValidationErrors>> + Send where Self: AsyncCheck { ... } fn parse_validated_json_async( input: &str, ) -> impl Future<Output = Result<AsyncValidated<Self>, ValidationErrors>> + Send where Self: AsyncCheck + Send { ... } fn parse_validated_json( input: &str, ) -> Result<Validated<Self>, ValidationErrors> { ... }
}
Expand description

High-level model API generated by #[derive(Model)].

Provided Methods§

Source

fn parse_json(input: &str) -> Result<Self, ValidationErrors>

Strict by default. Explicit field-level coerce is applied by the derive.

Source

fn parse_slice(input: &[u8]) -> Result<Self, ValidationErrors>

Source

fn parse_raw(raw: &RawValue) -> Result<Self, ValidationErrors>

Source

fn parse_value(value: Value) -> Result<Self, ValidationErrors>

Source

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

Recheck a value constructed or mutated in Rust. Does not normalize it.

Source

fn dump(&self) -> Result<Value, ValidationErrors>

Revalidate before serialization, including fields excluded from the output.

Source

fn dump_json(&self) -> Result<String, ValidationErrors>

Source

fn json_schema(mode: SchemaMode) -> Value

Source

fn schema_report(mode: SchemaMode) -> SchemaReport

Source

fn parse_reader<R: Read>(reader: R) -> Result<Self, ValidationErrors>

Source

fn parse_json_async( input: &str, ) -> impl Future<Output = Result<Self, ValidationErrors>> + Send
where Self: AsyncCheck + Send,

Source

fn parse_raw_async( raw: &RawValue, ) -> impl Future<Output = Result<Self, ValidationErrors>> + Send
where Self: AsyncCheck + Send,

Source

fn parse_value_async( value: Value, ) -> impl Future<Output = Result<Self, ValidationErrors>> + Send
where Self: AsyncCheck + Send,

Source

fn validate_async( &self, ) -> impl Future<Output = Result<(), ValidationErrors>> + Send
where Self: AsyncCheck,

Source

fn dump_async( &self, ) -> impl Future<Output = Result<Value, ValidationErrors>> + Send
where Self: AsyncCheck,

Source

fn dump_json_async( &self, ) -> impl Future<Output = Result<String, ValidationErrors>> + Send
where Self: AsyncCheck,

Source

fn parse_validated_json_async( input: &str, ) -> impl Future<Output = Result<AsyncValidated<Self>, ValidationErrors>> + Send
where Self: AsyncCheck + Send,

Source

fn parse_validated_json( input: &str, ) -> Result<Validated<Self>, ValidationErrors>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§