pub struct FieldValidator { /* private fields */ }Expand description
Helper for collecting validation errors across multiple fields
Implementations§
Source§impl FieldValidator
impl FieldValidator
Sourcepub fn add_if(&mut self, condition: bool, field: &str, message: &str)
pub fn add_if(&mut self, condition: bool, field: &str, message: &str)
Add an error conditionally
Sourcepub fn into_service_error(self) -> ServiceError
pub fn into_service_error(self) -> ServiceError
Convert into ServiceError::ValidationErrors
Sourcepub fn into_errors(self) -> Vec<(String, String)>
pub fn into_errors(self) -> Vec<(String, String)>
Get errors as Vec of tuples (consumes self)
Sourcepub fn as_static_errors(&self) -> Vec<(&str, &str)>
pub fn as_static_errors(&self) -> Vec<(&str, &str)>
Get errors as static str tuples (for backward compatibility)
Trait Implementations§
Source§impl Debug for FieldValidator
impl Debug for FieldValidator
Source§impl Default for FieldValidator
impl Default for FieldValidator
Source§fn default() -> FieldValidator
fn default() -> FieldValidator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FieldValidator
impl RefUnwindSafe for FieldValidator
impl Send for FieldValidator
impl Sync for FieldValidator
impl Unpin for FieldValidator
impl UnsafeUnpin for FieldValidator
impl UnwindSafe for FieldValidator
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
Mutably borrows from an owned value. Read more