#[non_exhaustive]pub struct Violation { /* private fields */ }Expand description
A single instance where a validation rule was not met.
Implementations§
Source§impl Violation
impl Violation
Sourcepub fn to_proto(&self) -> Violation
pub fn to_proto(&self) -> Violation
Serialize this violation into the wire-compatible protobuf message.
Sourcepub fn field_path(&self) -> String
pub fn field_path(&self) -> String
Returns the dot-separated field path where this violation occurred.
Sourcepub fn field_descriptor(&self) -> Option<&FieldDescriptor>
pub fn field_descriptor(&self) -> Option<&FieldDescriptor>
Returns the field descriptor for the violated field, if available.
Sourcepub fn field_value(&self) -> Option<&Value>
pub fn field_value(&self) -> Option<&Value>
Returns the field value that failed validation, when available.
Sourcepub fn rule_descriptor(&self) -> Option<&FieldDescriptor>
pub fn rule_descriptor(&self) -> Option<&FieldDescriptor>
Returns the descriptor for the violated rule field, when available.
Sourcepub fn rule_value(&self) -> Option<&Value>
pub fn rule_value(&self) -> Option<&Value>
Returns the value of the violated rule field, when available.
Sourcepub fn set_field_path(&mut self, field_path: impl Into<String>)
pub fn set_field_path(&mut self, field_path: impl Into<String>)
Sets the field path.
Sourcepub fn set_rule_path(&mut self, rule_path: impl Into<String>)
pub fn set_rule_path(&mut self, rule_path: impl Into<String>)
Sets the rule path.
Sourcepub fn set_rule_id(&mut self, rule_id: impl Into<String>)
pub fn set_rule_id(&mut self, rule_id: impl Into<String>)
Sets the machine-readable rule identifier.
Sourcepub fn set_message(&mut self, message: impl Into<String>)
pub fn set_message(&mut self, message: impl Into<String>)
Sets the human-readable violation message.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Violation
impl RefUnwindSafe for Violation
impl Send for Violation
impl Sync for Violation
impl Unpin for Violation
impl UnsafeUnpin for Violation
impl UnwindSafe for Violation
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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