pub struct ValidationError {
pub path: String,
pub kind: ValidationKind,
pub actual: Option<ValidationMeasure>,
pub limit: Option<ValidationMeasure>,
}Expand description
Typed validation failure for a wire payload.
path is a JSON-like field path (tempo, spikes, traces[1].channel_id).
actual / limit identify the observed value or size and the applicable
bound when those are meaningful for kind.
Fields§
§path: StringField or indexed path that failed.
kind: ValidationKindStable error kind.
actual: Option<ValidationMeasure>Observed value, count, or byte length when applicable.
limit: Option<ValidationMeasure>Applicable limit or documented range.
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn non_finite(path: impl Into<String>, actual: f32) -> Self
pub fn non_finite(path: impl Into<String>, actual: f32) -> Self
Non-finite float at path.
Sourcepub fn out_of_range(
path: impl Into<String>,
actual: f32,
min: f32,
max: f32,
) -> Self
pub fn out_of_range( path: impl Into<String>, actual: f32, min: f32, max: f32, ) -> Self
Float outside [min, max] at path.
Sourcepub fn length_mismatch(
path: impl Into<String>,
actual: usize,
expected: usize,
) -> Self
pub fn length_mismatch( path: impl Into<String>, actual: usize, expected: usize, ) -> Self
Related sequences had different lengths.
Sourcepub fn limit_exceeded(
path: impl Into<String>,
actual: usize,
limit: usize,
) -> Self
pub fn limit_exceeded( path: impl Into<String>, actual: usize, limit: usize, ) -> Self
Collection length exceeded limit.
Sourcepub fn byte_limit(path: impl Into<String>, actual: usize, limit: usize) -> Self
pub fn byte_limit(path: impl Into<String>, actual: usize, limit: usize) -> Self
String byte length exceeded limit.
Sourcepub fn nested_metadata(path: impl Into<String>) -> Self
pub fn nested_metadata(path: impl Into<String>) -> Self
Nested metadata policy violation (for example an empty key).
Sourcepub fn duplicate_identifier(
path: impl Into<String>,
identifier: impl Display,
) -> Self
pub fn duplicate_identifier( path: impl Into<String>, identifier: impl Display, ) -> Self
Duplicate identifier at path.
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
impl Eq for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<ValidationError> for CanonicalEncodeError
impl From<ValidationError> for CanonicalEncodeError
Source§fn from(source: ValidationError) -> Self
fn from(source: ValidationError) -> Self
Converts to this type from the input type.
Source§impl From<ValidationError> for ZmqMessageError
impl From<ValidationError> for ZmqMessageError
Source§fn from(source: ValidationError) -> Self
fn from(source: ValidationError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ValidationError
impl PartialEq for ValidationError
impl StructuralPartialEq for ValidationError
Auto Trait Implementations§
impl Freeze for ValidationError
impl RefUnwindSafe for ValidationError
impl Send for ValidationError
impl Sync for ValidationError
impl Unpin for ValidationError
impl UnsafeUnpin for ValidationError
impl UnwindSafe for ValidationError
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