Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions validator/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ impl ValidationErrors {
})
.collect::<HashMap<_, _>>()
}
/// Add a field validation error to the struct, returning self
pub fn with_error(mut self, field: &'static str, error: ValidationError) -> ValidationErrors {
self.add(field, error);
self
}

/// Add a field validation error to the struct
pub fn add(&mut self, field: &'static str, error: ValidationError) {
if let ValidationErrorsKind::Field(ref mut vec) = self
.0
Expand Down
Loading