#[non_exhaustive]pub enum ValidationError {
MissingRequiredField {
block: Cow<'static, str>,
field: Cow<'static, str>,
line: Option<usize>,
},
Conflict {
fields: Vec<Cow<'static, str>>,
line: Option<usize>,
},
InvalidValue {
field: Cow<'static, str>,
value: String,
expected: Cow<'static, str>,
line: Option<usize>,
},
OutOfRange {
name: Cow<'static, str>,
value: String,
expected: Cow<'static, str>,
line: Option<usize>,
},
Generic {
message: Cow<'static, str>,
line: Option<usize>,
},
}Expand description
Errors related to the validation of NDM data against CCSDS rules.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
MissingRequiredField
A required field was missing in the message.
Conflict
Two or more fields are in conflict.
InvalidValue
A value was provided that does not match the CCSDS specification.
OutOfRange
Specific validation error for values out of expected range.
Generic
General validation errors for cases not covered by specific variants.
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn missing_required(
block: impl Into<Cow<'static, str>>,
field: impl Into<Cow<'static, str>>,
) -> Self
pub fn missing_required( block: impl Into<Cow<'static, str>>, field: impl Into<Cow<'static, str>>, ) -> Self
Convenience constructor for a missing required field error.
Sourcepub fn invalid_value(
field: impl Into<Cow<'static, str>>,
value: impl Into<String>,
expected: impl Into<Cow<'static, str>>,
) -> Self
pub fn invalid_value( field: impl Into<Cow<'static, str>>, value: impl Into<String>, expected: impl Into<Cow<'static, str>>, ) -> Self
Convenience constructor for an invalid value error.
Sourcepub fn generic(message: impl Into<Cow<'static, str>>) -> Self
pub fn generic(message: impl Into<Cow<'static, str>>) -> Self
Convenience constructor for a generic validation error.
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display 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 CcsdsNdmError
impl From<ValidationError> for CcsdsNdmError
Source§fn from(e: ValidationError) -> Self
fn from(e: ValidationError) -> Self
Converts to this type from the input type.
Source§impl FromExternalError<&str, ValidationError> for InternalParserError
impl FromExternalError<&str, ValidationError> for InternalParserError
Source§fn from_external_error(_input: &&str, e: ValidationError) -> Self
fn from_external_error(_input: &&str, e: ValidationError) -> Self
Like
ParserError::from_input but also include an external error.Source§impl PartialEq for ValidationError
impl PartialEq for ValidationError
Source§impl WithLocation for ValidationError
impl WithLocation 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