pub struct Meta {
pub name: String,
pub description: Option<String>,
pub examples: Vec<(Value, Option<String>)>,
pub default: Option<Value>,
pub convert: Option<ValueType>,
}Expand description
Human-facing metadata a validator carries and attaches to its errors.
Set through the WithMeta builder methods (with_name, with_description, with_default,
to_int, …) available on every validator. On a validation failure a validator attaches its own
Meta to the Error (innermost wins), so messages can name the field and offer a description,
examples, and a default. convert requests a post-validation output cast (see
Validator::validate).
Fields§
§name: String§description: Option<String>§examples: Vec<(Value, Option<String>)>Example values, each with an optional note explaining it.
default: Option<Value>§convert: Option<ValueType>Target type for the post-validation output cast, if any.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Meta
Auto Trait Implementations§
impl Freeze for Meta
impl RefUnwindSafe for Meta
impl Send for Meta
impl Sync for Meta
impl Unpin for Meta
impl UnsafeUnpin for Meta
impl UnwindSafe for Meta
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more