pub fn validate<S, T>(data: &T) -> Result<(), VldServerError>Expand description
Validate a serializable value against a vld schema type.
Serializes data to JSON, then validates using S::vld_parse_value().
§Example
ⓘ
vld::schema! {
struct UserInput {
name: String => vld::string().min(2),
email: String => vld::string().email(),
}
}
#[derive(Serialize)]
struct Args { name: String, email: String }
vld_dioxus::validate::<UserInput, _>(&Args { name, email })?;