#[non_exhaustive]pub enum Tarifzeit {
TzStandard,
TzHt,
TzNt,
Unknown,
}versioned and (crate features json or versioned) only.Expand description
Zur Kennzeichnung verschiedener Tarifzeiten, beispielsweise zur Bepreisung oder zur Verbrauchsermittlung.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TzStandard
TzHt
TzNt
Unknown
Unknown or future variant — produced when deserializing a value that is not yet known to this version of the library.
Implementations§
Source§impl Tarifzeit
impl Tarifzeit
Sourcepub const VARIANTS: &'static [Self]
pub const VARIANTS: &'static [Self]
All variants defined by the BO4E schema, in declaration order.
Excludes the forward-compatibility Tarifzeit::Unknown catch-all, so this
is exactly the set of values that appear on the wire. Available without
the strum feature — use it to drift-guard SQL CHECK lists and mappings.
Sourcepub const COUNT: usize
pub const COUNT: usize
Number of schema-defined variants (equal to VARIANTS.len()), excluding the
Tarifzeit::Unknown catch-all. Stable for this schema version.
Sourcepub fn iter_known() -> impl Iterator<Item = Self> + Clone
pub fn iter_known() -> impl Iterator<Item = Self> + Clone
Returns an iterator over all known variants of Tarifzeit.
Yields only variants that correspond to values defined in the BO4E schema
(i.e. Self::VARIANTS), never the Tarifzeit::Unknown catch-all.
Available without the strum feature.
§Example
// Never yields the `Unknown` catch-all, so the count matches `COUNT`.
assert_eq!(Tarifzeit::iter_known().count(), Tarifzeit::COUNT);
assert!(Tarifzeit::iter_known().all(|v| v.is_known()));Sourcepub const fn as_wire(&self) -> &'static str
pub const fn as_wire(&self) -> &'static str
Returns the canonical BO4E wire string (SCREAMING_SNAKE_CASE) for this value.
Tarifzeit::Unknown renders as "UNKNOWN", matching its serialized form.
Sourcepub fn from_wire(s: &str) -> Result<Self, UnknownVariant>
pub fn from_wire(s: &str) -> Result<Self, UnknownVariant>
Strictly parses a BO4E wire string into a known variant.
Unlike the lenient serde / FromStr path — which maps
any unrecognized value (a typo, a legacy code, or a value from a newer schema)
to Tarifzeit::Unknown — this returns
Err for values not defined in this schema
version, including the literal "UNKNOWN". Use it at the ingest boundary to
reject bad values instead of silently degrading them.
§Example
assert_eq!(Tarifzeit::from_wire("TZ_STANDARD"), Ok(Tarifzeit::TzStandard));
// Out-of-schema values are rejected rather than degraded:
assert!(Tarifzeit::from_wire("NOT_A_REAL_VALUE").is_err());
// …including the `Unknown` catch-all's own wire spelling:
assert!(Tarifzeit::from_wire("UNKNOWN").is_err());Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true if this value is the forward-compatibility
Tarifzeit::Unknown catch-all (an out-of-schema value).
Trait Implementations§
Source§impl Bo4eEnum for Tarifzeit
impl Bo4eEnum for Tarifzeit
Source§const VARIANTS: &'static [Self] = Self::VARIANTS
const VARIANTS: &'static [Self] = Self::VARIANTS
Source§const COUNT: usize = Self::COUNT
const COUNT: usize = Self::COUNT
VARIANTS.len()), excluding
the Unknown catch-all. Stable for a given schema version — use it to
drift-guard hand-maintained variant counts.Source§fn as_wire(&self) -> &'static str
fn as_wire(&self) -> &'static str
Source§fn is_unknown(&self) -> bool
fn is_unknown(&self) -> bool
true if this value is the forward-compatibility Unknown
catch-all — i.e. an out-of-schema value produced by a lenient decode.Source§impl Bo4eStrict for Tarifzeit
impl Bo4eStrict for Tarifzeit
Source§fn collect_unknown_enums(&self, path: &str, out: &mut Vec<String>)
fn collect_unknown_enums(&self, path: &str, out: &mut Vec<String>)
out, the field_path-formatted
location of every enum field in self (recursively) that holds the
forward-compatibility Unknown catch-all. path is the JSON-path of
self relative to the root of the check ("" at the top level). Read moreSource§fn unknown_enum_paths(&self) -> Vec<String>
fn unknown_enum_paths(&self) -> Vec<String>
Unknown. Empty when the value is fully in-schema.Source§fn ensure_known_enums(&self) -> Result<(), StrictError>
fn ensure_known_enums(&self) -> Result<(), StrictError>
Err(StrictError) listing every
out-of-schema (Unknown) enum value in self, or Ok(()) if there are
none. Call this after a lenient serde decode to reject payloads that
carry typos, legacy codes, or values from a newer schema.impl Copy for Tarifzeit
Source§impl<'r> Decode<'r, Postgres> for Tarifzeit
Available on crate feature sqlx only.Decodes leniently, matching the serde path: a value the schema does not
define becomes Tarifzeit::Unknown rather than a decode error, so a
database row written by a newer schema version still reads back.
impl<'r> Decode<'r, Postgres> for Tarifzeit
sqlx only.Decodes leniently, matching the serde path: a value the schema does not
define becomes Tarifzeit::Unknown rather than a decode error, so a
database row written by a newer schema version still reads back.
Use Tarifzeit::from_wire on a String column, or check
Tarifzeit::is_known, where out-of-schema values must be rejected.
Source§impl<'de> Deserialize<'de> for Tarifzeit
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Tarifzeit
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'q> Encode<'q, Postgres> for Tarifzeit
Available on crate feature sqlx only.Encodes as the canonical BO4E wire string, borrowed from as_wire — no
intermediate String or serde_json::Value is allocated.
impl<'q> Encode<'q, Postgres> for Tarifzeit
sqlx only.Encodes as the canonical BO4E wire string, borrowed from as_wire — no
intermediate String or serde_json::Value is allocated.
Source§fn encode_by_ref(
&self,
buf: &mut <Postgres as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, buf: &mut <Postgres as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Send + Sync>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
impl Eq for Tarifzeit
Source§impl IntoEnumIterator for Tarifzeit
Available on crate feature strum only.
impl IntoEnumIterator for Tarifzeit
strum only.type Iterator = TarifzeitIter
fn iter() -> TarifzeitIter ⓘ
Source§impl JsonSchema for Tarifzeit
Available on crate feature schemars only.
impl JsonSchema for Tarifzeit
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for Tarifzeit
impl Ord for Tarifzeit
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Tarifzeit
impl PartialOrd for Tarifzeit
Source§impl PgHasArrayType for Tarifzeit
Available on crate feature sqlx only.Lets Vec<Tarifzeit> bind to a TEXT[] column. Only this crate can
provide it: the trait and the enum are both foreign to any consumer, so the
orphan rule rules out a downstream impl.
impl PgHasArrayType for Tarifzeit
sqlx only.Lets Vec<Tarifzeit> bind to a TEXT[] column. Only this crate can
provide it: the trait and the enum are both foreign to any consumer, so the
orphan rule rules out a downstream impl.
fn array_type_info() -> PgTypeInfo
fn array_compatible(ty: &PgTypeInfo) -> bool
impl StructuralPartialEq for Tarifzeit
Auto Trait Implementations§
impl Freeze for Tarifzeit
impl RefUnwindSafe for Tarifzeit
impl Send for Tarifzeit
impl Sync for Tarifzeit
impl Unpin for Tarifzeit
impl UnsafeUnpin for Tarifzeit
impl UnwindSafe for Tarifzeit
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
Source§impl<T> PartialSchema for Twhere
T: ComposeSchema + ?Sized,
impl<T> PartialSchema for Twhere
T: ComposeSchema + ?Sized,
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