pub enum TypesValidationError {
InvalidConfidence {
value: String,
},
EmptyContent,
MissingField {
field: String,
},
ConstraintViolated {
constraint: String,
},
SchemaMismatch {
expected: String,
actual: String,
},
InvalidFormat {
description: String,
},
}Expand description
Errors during validation.
Uses “Types” prefix to avoid collision with existing ValidationError. Implements Clone, PartialEq, Eq for use in tests and assertions.
Variants§
InvalidConfidence
Invalid confidence value.
EmptyContent
Empty content not allowed.
MissingField
Missing required field.
ConstraintViolated
Constraint violated.
SchemaMismatch
Schema mismatch.
InvalidFormat
Invalid format.
Implementations§
Source§impl TypesValidationError
impl TypesValidationError
Sourcepub fn invalid_confidence(value: f32) -> TypesValidationError
pub fn invalid_confidence(value: f32) -> TypesValidationError
Create an invalid confidence error.
Sourcepub fn missing_field(field: impl Into<String>) -> TypesValidationError
pub fn missing_field(field: impl Into<String>) -> TypesValidationError
Create a missing field error.
Sourcepub fn constraint_violated(
constraint: impl Into<String>,
) -> TypesValidationError
pub fn constraint_violated( constraint: impl Into<String>, ) -> TypesValidationError
Create a constraint violated error.
Sourcepub fn schema_mismatch(
expected: impl Into<String>,
actual: impl Into<String>,
) -> TypesValidationError
pub fn schema_mismatch( expected: impl Into<String>, actual: impl Into<String>, ) -> TypesValidationError
Create a schema mismatch error.
Sourcepub fn invalid_format(description: impl Into<String>) -> TypesValidationError
pub fn invalid_format(description: impl Into<String>) -> TypesValidationError
Create an invalid format error.
Trait Implementations§
Source§impl Clone for TypesValidationError
impl Clone for TypesValidationError
Source§fn clone(&self) -> TypesValidationError
fn clone(&self) -> TypesValidationError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TypesValidationError
impl Debug for TypesValidationError
Source§impl<'de> Deserialize<'de> for TypesValidationError
impl<'de> Deserialize<'de> for TypesValidationError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TypesValidationError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TypesValidationError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for TypesValidationError
impl Display for TypesValidationError
Source§impl Error for TypesValidationError
impl Error for TypesValidationError
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 PartialEq for TypesValidationError
impl PartialEq for TypesValidationError
Source§fn eq(&self, other: &TypesValidationError) -> bool
fn eq(&self, other: &TypesValidationError) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for TypesValidationError
impl Serialize for TypesValidationError
Source§fn 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,
Serialize this value into the given Serde serializer. Read more
impl Eq for TypesValidationError
impl StructuralPartialEq for TypesValidationError
Auto Trait Implementations§
impl Freeze for TypesValidationError
impl RefUnwindSafe for TypesValidationError
impl Send for TypesValidationError
impl Sync for TypesValidationError
impl Unpin for TypesValidationError
impl UnsafeUnpin for TypesValidationError
impl UnwindSafe for TypesValidationError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.