pub struct ValidationErrors {
pub errors: Vec<ValidationError>,
/* private fields */
}Expand description
Collects multiple validation errors with structured paths.
Fields§
§errors: Vec<ValidationError>Implementations§
Source§impl ValidationErrors
impl ValidationErrors
Sourcepub fn single(msg: impl Into<String>) -> Self
pub fn single(msg: impl Into<String>) -> Self
Create a ValidationErrors with a single root-level message.
Sourcepub fn add(&mut self, path: &[PathElement], msg: impl Into<String>)
pub fn add(&mut self, path: &[PathElement], msg: impl Into<String>)
Add an error at the given path.
Sourcepub fn add_with_detail(
&mut self,
path: &[PathElement],
msg: impl Into<String>,
detail: ErrorDetail,
)
pub fn add_with_detail( &mut self, path: &[PathElement], msg: impl Into<String>, detail: ErrorDetail, )
Add an error at the given path with structured diagnostic detail.
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn into_result(self, model_name: &str) -> Result<(), ModelError>
Trait Implementations§
Source§impl Debug for ValidationErrors
impl Debug for ValidationErrors
Source§impl Default for ValidationErrors
impl Default for ValidationErrors
Source§fn default() -> ValidationErrors
fn default() -> ValidationErrors
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze 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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more