pub struct UnknownVariant {
pub value: String,
}Expand description
Error returned by an enum’s from_wire strict parser when the input
string does not correspond to any variant defined in this schema version.
Unlike the serde / FromStr deserialization path — which maps every
unrecognized value to the forward-compatibility Unknown catch-all — the
generated T::from_wire associated function returns this error for values
that are not part of the current BO4E schema. Use it at the ingest boundary
to reject typos, legacy codes, or values from a newer schema, instead of
having them silently degrade to Unknown.
§Example
use rubo4e::current::Marktrolle;
assert!(Marktrolle::from_wire("LF").is_ok());
// Legacy / typo'd values are rejected rather than silently accepted:
assert!(Marktrolle::from_wire("LFG").is_err());Fields§
§value: StringThe unrecognized wire value that was rejected.
Implementations§
Source§impl UnknownVariant
impl UnknownVariant
Sourcepub fn new(value: impl Into<String>) -> Self
pub fn new(value: impl Into<String>) -> Self
Constructs an UnknownVariant from the offending wire value.
Trait Implementations§
Source§impl Clone for UnknownVariant
impl Clone for UnknownVariant
Source§fn clone(&self) -> UnknownVariant
fn clone(&self) -> UnknownVariant
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UnknownVariant
impl Debug for UnknownVariant
Source§impl Display for UnknownVariant
impl Display for UnknownVariant
impl Eq for UnknownVariant
Source§impl Error for UnknownVariant
impl Error for UnknownVariant
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<UnknownVariant> for Error
Available on crate feature validate only.
impl From<UnknownVariant> for Error
validate only.Source§fn from(e: UnknownVariant) -> Self
fn from(e: UnknownVariant) -> Self
Converts an UnknownVariant into a garde::Error so strict enum
parsing can participate in garde-driven validation pipelines.
Source§impl PartialEq for UnknownVariant
impl PartialEq for UnknownVariant
impl StructuralPartialEq for UnknownVariant
Auto Trait Implementations§
impl Freeze for UnknownVariant
impl RefUnwindSafe for UnknownVariant
impl Send for UnknownVariant
impl Sync for UnknownVariant
impl Unpin for UnknownVariant
impl UnsafeUnpin for UnknownVariant
impl UnwindSafe for UnknownVariant
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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, O> Matches<O> for Twhere
T: PartialEq<O>,
impl<T, O> Matches<O> for Twhere
T: PartialEq<O>,
fn validate_matches(&self, other: &O) -> bool
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§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>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more