pub struct ValidationErrors(pub HashMap<Cow<'static, str>, ValidationErrorsKind>);
Tuple Fields§
§0: HashMap<Cow<'static, str>, ValidationErrorsKind>
Implementations§
Source§impl ValidationErrors
impl ValidationErrors
pub fn new() -> ValidationErrors
Sourcepub fn has_error(
result: &Result<(), ValidationErrors>,
field: &'static str,
) -> bool
pub fn has_error( result: &Result<(), ValidationErrors>, field: &'static str, ) -> bool
Returns a boolean indicating whether a validation result includes validation errors for a given field. May be used as a condition for performing nested struct validations on a field in the absence of field-level validation errors.
pub fn merge_self( &mut self, field: &'static str, child: Result<(), ValidationErrors>, ) -> &mut ValidationErrors
Sourcepub fn merge(
parent: Result<(), ValidationErrors>,
field: &'static str,
child: Result<(), ValidationErrors>,
) -> Result<(), ValidationErrors>
pub fn merge( parent: Result<(), ValidationErrors>, field: &'static str, child: Result<(), ValidationErrors>, ) -> Result<(), ValidationErrors>
Returns the combined outcome of a struct’s validation result along with the nested validation result for one of its fields.
Sourcepub fn merge_all(
parent: Result<(), ValidationErrors>,
field: &'static str,
children: Vec<Result<(), ValidationErrors>>,
) -> Result<(), ValidationErrors>
pub fn merge_all( parent: Result<(), ValidationErrors>, field: &'static str, children: Vec<Result<(), ValidationErrors>>, ) -> Result<(), ValidationErrors>
Returns the combined outcome of a struct’s validation result along with the nested validation result for one of its fields where that field is a vector of validating structs.
Sourcepub fn errors(&self) -> &HashMap<Cow<'static, str>, ValidationErrorsKind>
pub fn errors(&self) -> &HashMap<Cow<'static, str>, ValidationErrorsKind>
Returns a 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.
Sourcepub fn errors_mut(
&mut self,
) -> &mut HashMap<Cow<'static, str>, ValidationErrorsKind>
pub fn errors_mut( &mut self, ) -> &mut HashMap<Cow<'static, str>, ValidationErrorsKind>
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.
Sourcepub fn into_errors(self) -> HashMap<Cow<'static, str>, ValidationErrorsKind>
pub fn into_errors(self) -> HashMap<Cow<'static, str>, ValidationErrorsKind>
Consume the struct, returning the validation errors found
Sourcepub fn field_errors(&self) -> HashMap<Cow<'static, str>, &Vec<ValidationError>>
pub fn field_errors(&self) -> HashMap<Cow<'static, str>, &Vec<ValidationError>>
Returns a map of only field-level validation errors found for the struct that was validated.
pub fn add(&mut self, field: &'static str, error: ValidationError)
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for ValidationErrors
impl Clone for ValidationErrors
Source§fn clone(&self) -> ValidationErrors
fn clone(&self) -> ValidationErrors
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more