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§
Sourcefn parse_json(input: &str) -> Result<Self, ValidationErrors>
fn parse_json(input: &str) -> Result<Self, ValidationErrors>
Strict by default. Explicit field-level coerce is applied by the derive.
fn parse_slice(input: &[u8]) -> Result<Self, ValidationErrors>
fn parse_raw(raw: &RawValue) -> Result<Self, ValidationErrors>
fn parse_value(value: Value) -> Result<Self, ValidationErrors>
Sourcefn validate(&self) -> Result<(), ValidationErrors>
fn validate(&self) -> Result<(), ValidationErrors>
Recheck a value constructed or mutated in Rust. Does not normalize it.
Sourcefn dump(&self) -> Result<Value, ValidationErrors>
fn dump(&self) -> Result<Value, ValidationErrors>
Revalidate before serialization, including fields excluded from the output.
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>> + Sendwhere
Self: AsyncCheck + Send,
fn parse_raw_async(
raw: &RawValue,
) -> impl Future<Output = Result<Self, ValidationErrors>> + Sendwhere
Self: AsyncCheck + Send,
fn parse_value_async(
value: Value,
) -> impl Future<Output = Result<Self, ValidationErrors>> + Sendwhere
Self: AsyncCheck + Send,
fn validate_async(
&self,
) -> impl Future<Output = Result<(), ValidationErrors>> + Sendwhere
Self: AsyncCheck,
fn dump_async(
&self,
) -> impl Future<Output = Result<Value, ValidationErrors>> + Sendwhere
Self: AsyncCheck,
fn dump_json_async(
&self,
) -> impl Future<Output = Result<String, ValidationErrors>> + Sendwhere
Self: AsyncCheck,
fn parse_validated_json_async(
input: &str,
) -> impl Future<Output = Result<AsyncValidated<Self>, ValidationErrors>> + Sendwhere
Self: AsyncCheck + Send,
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".