pub struct ValidationErrors(pub HashMap<&'static str, ValidationErrorsKind>);Tuple Fields§
§0: HashMap<&'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<&'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 errors_mut(&mut self) -> &mut HashMap<&'static str, ValidationErrorsKind>
pub fn errors_mut(&mut self) -> &mut HashMap<&'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<&'static str, ValidationErrorsKind>
pub fn into_errors(self) -> HashMap<&'static str, ValidationErrorsKind>
Consume the struct, returning the validation errors found
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§
Source§impl Clone for ValidationErrors
impl Clone for ValidationErrors
Source§fn clone(&self) -> ValidationErrors
fn clone(&self) -> ValidationErrors
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Source§impl Display for ValidationErrors
impl Display for ValidationErrors
Source§impl Error for ValidationErrors
impl Error for ValidationErrors
Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§fn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
replaced by Error::source, which can support downcasting
Error::source.Source§impl PartialEq for ValidationErrors
impl PartialEq for ValidationErrors
Source§impl Serialize for ValidationErrors
impl Serialize for ValidationErrors
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ValidationErrors
Source§impl Validatable for ValidationErrors
impl Validatable for ValidationErrors
Auto Trait Implementations§
impl Forget for ValidationErrors
impl Freeze for ValidationErrors
impl Move 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().