Struct rocket_validation::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>, Global>
) -> Result<(), ValidationErrors>
pub fn merge_all(
parent: Result<(), ValidationErrors>,
field: &'static str,
children: Vec<Result<(), ValidationErrors>, Global>
) -> 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, RandomState>
pub fn errors(
&self
) -> &HashMap<&'static str, ValidationErrorsKind, RandomState>
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, RandomState>
pub fn errors_mut(
&mut self
) -> &mut HashMap<&'static str, ValidationErrorsKind, RandomState>
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, RandomState>
pub fn into_errors(
self
) -> HashMap<&'static str, ValidationErrorsKind, RandomState>
Consume the struct, returning the validation errors found
sourcepub fn field_errors(
&self
) -> HashMap<&'static str, &Vec<ValidationError, Global>, RandomState>
pub fn field_errors(
&self
) -> HashMap<&'static str, &Vec<ValidationError, Global>, RandomState>
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
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for ValidationErrors
impl Debug for ValidationErrors
sourceimpl Default for ValidationErrors
impl Default for ValidationErrors
sourcefn default() -> ValidationErrors
fn default() -> ValidationErrors
sourceimpl Display for ValidationErrors
impl Display for ValidationErrors
sourceimpl Error for ValidationErrors
impl Error for ValidationErrors
sourcefn description(&self) -> &str
fn description(&self) -> &str
sourcefn cause(&self) -> Option<&dyn Error>
fn cause(&self) -> Option<&dyn Error>
sourceimpl PartialEq<ValidationErrors> for ValidationErrors
impl PartialEq<ValidationErrors> for ValidationErrors
sourcefn eq(&self, other: &ValidationErrors) -> bool
fn eq(&self, other: &ValidationErrors) -> bool
sourceimpl Serialize for ValidationErrors
impl Serialize for ValidationErrors
sourcefn 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
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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A>where
A: Array<Item = T>,
fn into_collection<A>(self) -> SmallVec<A>where
A: Array<Item = T>,
self
into a collection.