pub trait Schema:
VldSchema
+ JsonSchema
+ CollectNestedSchemas { }Expand description
A schema with everything the enabled features need: VldSchema, plus
JsonSchema and
CollectNestedSchemas with the
openapi feature.
Use it to return a schema from a function without naming its type: an
impl VldSchema hides the JSON Schema impls, so the result could not be
used in an object or schema! field with openapi on.
use vld::prelude::*;
fn username() -> impl vld::Schema<Output = String> {
vld::string().min(3).max(20).alphanumeric()
}
let user = vld::object().field("name", username());
assert!(user.parse(r#"{"name": "ada"}"#).is_ok());Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".