Struct validator::ValidationErrors
source · [−]pub struct ValidationErrors(_);
Implementations
sourceimpl 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.
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<&'static str, ValidationErrorsKind>
pub fn errors(self) -> HashMap<&'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 field_errors(self) -> HashMap<&'static str, Vec<ValidationError>>
pub fn field_errors(self) -> HashMap<&'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
sourceimpl Clone for ValidationErrors
impl Clone for ValidationErrors
sourcefn clone(&self) -> ValidationErrors
fn clone(&self) -> ValidationErrors
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ValidationErrors
impl Debug for ValidationErrors
sourceimpl Default for ValidationErrors
impl Default for ValidationErrors
sourcefn default() -> ValidationErrors
fn default() -> ValidationErrors
Returns the “default value” for a type. Read more
sourceimpl Display for ValidationErrors
impl Display for ValidationErrors
sourceimpl Error for ValidationErrors
impl Error for ValidationErrors
sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourcefn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
replaced by Error::source, which can support downcasting
sourceimpl PartialEq<ValidationErrors> for ValidationErrors
impl PartialEq<ValidationErrors> for ValidationErrors
sourcefn eq(&self, other: &ValidationErrors) -> bool
fn eq(&self, other: &ValidationErrors) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ValidationErrors) -> bool
fn ne(&self, other: &ValidationErrors) -> bool
This method tests for !=
.
sourceimpl Serialize for ValidationErrors
impl Serialize for ValidationErrors
impl StructuralPartialEq for ValidationErrors
Auto Trait Implementations
impl RefUnwindSafe for ValidationErrors
impl Send for ValidationErrors
impl Sync for ValidationErrors
impl Unpin for ValidationErrors
impl UnwindSafe for ValidationErrors
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more