pub struct ValidationErrors {
pub fields: HashMap<String, Vec<RuleError>>,
}Expand description
Collection of validation errors for multiple fields.
Fields§
§fields: HashMap<String, Vec<RuleError>>Map of field name to list of errors for that field
Implementations§
Source§impl ValidationErrors
impl ValidationErrors
Sourcepub fn add_all(&mut self, field: impl Into<String>, errors: Vec<RuleError>)
pub fn add_all(&mut self, field: impl Into<String>, errors: Vec<RuleError>)
Add multiple errors for a field.
Sourcepub fn merge(&mut self, other: ValidationErrors)
pub fn merge(&mut self, other: ValidationErrors)
Merge another ValidationErrors into this one.
Sourcepub fn into_result(self) -> Result<(), Self>
pub fn into_result(self) -> Result<(), Self>
Convert to Result - Ok if no errors, Err otherwise.
Sourcepub fn field_names(&self) -> Vec<&str>
pub fn field_names(&self) -> Vec<&str>
Get all field names with errors.
Sourcepub fn to_api_error(&self) -> ApiValidationError
pub fn to_api_error(&self) -> ApiValidationError
Convert to the standard RustAPI error format.
Trait Implementations§
Source§impl Clone for ValidationErrors
impl Clone for ValidationErrors
Source§fn clone(&self) -> ValidationErrors
fn clone(&self) -> ValidationErrors
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 ValidationErrors
impl Debug for ValidationErrors
Source§impl Default for ValidationErrors
impl Default for ValidationErrors
Source§fn default() -> ValidationErrors
fn default() -> ValidationErrors
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ValidationErrors
impl<'de> Deserialize<'de> for ValidationErrors
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ValidationErrors
impl Display for ValidationErrors
Source§impl Error for ValidationErrors
impl Error for ValidationErrors
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ValidationErrors
impl RefUnwindSafe for ValidationErrors
impl Send for ValidationErrors
impl Sync for ValidationErrors
impl Unpin for ValidationErrors
impl UnsafeUnpin for ValidationErrors
impl UnwindSafe for ValidationErrors
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ValidateIp for Twhere
T: ToString,
impl<T> ValidateIp for Twhere
T: ToString,
Source§fn validate_ipv4(&self) -> bool
fn validate_ipv4(&self) -> bool
Validates whether the given string is an IP V4
Source§fn validate_ipv6(&self) -> bool
fn validate_ipv6(&self) -> bool
Validates whether the given string is an IP V6
Source§fn validate_ip(&self) -> bool
fn validate_ip(&self) -> bool
Validates whether the given string is an IP