#[non_exhaustive]pub struct ValidationMessage {
pub message: String,
pub level: Level,
pub metadata: HashMap<String, String>,
pub code: String,
/* private fields */
}
Expand description
Represent user-facing validation result message.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.message: String
The result of the validation.
level: Level
Message severity level (warning or error).
metadata: HashMap<String, String>
Additional metadata related to the result.
code: String
A custom code identifying this specific message.
Implementations§
Source§impl ValidationMessage
impl ValidationMessage
pub fn new() -> Self
Sourcepub fn set_message<T: Into<String>>(self, v: T) -> Self
pub fn set_message<T: Into<String>>(self, v: T) -> Self
Sets the value of message.
Sourcepub fn set_metadata<T, K, V>(self, v: T) -> Self
pub fn set_metadata<T, K, V>(self, v: T) -> Self
Sets the value of metadata.
Trait Implementations§
Source§impl Clone for ValidationMessage
impl Clone for ValidationMessage
Source§fn clone(&self) -> ValidationMessage
fn clone(&self) -> ValidationMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ValidationMessage
impl Debug for ValidationMessage
Source§impl Default for ValidationMessage
impl Default for ValidationMessage
Source§fn default() -> ValidationMessage
fn default() -> ValidationMessage
Returns the “default value” for a type. Read more
Source§impl Message for ValidationMessage
impl Message for ValidationMessage
Source§impl PartialEq for ValidationMessage
impl PartialEq for ValidationMessage
impl StructuralPartialEq for ValidationMessage
Auto Trait Implementations§
impl Freeze for ValidationMessage
impl RefUnwindSafe for ValidationMessage
impl Send for ValidationMessage
impl Sync for ValidationMessage
impl Unpin for ValidationMessage
impl UnwindSafe for ValidationMessage
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