pub struct FieldViolation {
pub field: String,
pub rule: &'static str,
pub message: String,
pub expected: Value,
pub got: Option<Value>,
}Expand description
One field-level constraint violation, structured for a caller to read.
Fields§
§field: StringJSON-pointer-ish field path. Top-level field names (“code”), nested
dotted paths (“config.timeout”), or array elements (“items[2]”).
rule: &'static strShort rule identifier — "range", "one_of", "regex", "length",
"exactly_one", "at_least_one", "all_of", "any_of", "not",
"custom".
message: StringHuman-readable description of what’s wrong.
expected: ValueMachine-readable description of the expected shape, e.g.
{"min":100, "max":599} or {"one_of":["a","b"]} — exactly what
the rule asserts.
got: Option<Value>The actual value that violated, when extractable.
Trait Implementations§
Source§impl Clone for FieldViolation
impl Clone for FieldViolation
Source§fn clone(&self) -> FieldViolation
fn clone(&self) -> FieldViolation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FieldViolation
impl RefUnwindSafe for FieldViolation
impl Send for FieldViolation
impl Sync for FieldViolation
impl Unpin for FieldViolation
impl UnsafeUnpin for FieldViolation
impl UnwindSafe for FieldViolation
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