Skip to content

Commit

Permalink
add: ValidationErrors::errors_mut (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Mar 15, 2022
1 parent 329bcf9 commit 3161a85
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions validator/src/types.rs
Expand Up @@ -109,6 +109,12 @@ impl ValidationErrors {
&self.0
}

/// Returns a mutable map of field-level validation errors found for the struct that was validated and
/// any of it's nested structs that are tagged for validation.
pub fn errors_mut(&mut self) -> &mut HashMap<&'static str, ValidationErrorsKind> {
&mut self.0
}

/// Consume the struct, returning the validation errors found
pub fn into_errors(self) -> HashMap<&'static str, ValidationErrorsKind> {
self.0
Expand Down

0 comments on commit 3161a85

Please sign in to comment.