#[non_exhaustive]pub enum RuntimeEnvironment {
Flink111,
Flink113,
Flink115,
Flink16,
Flink18,
Sql10,
ZeppelinFlink10,
ZeppelinFlink20,
ZeppelinFlink30,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against RuntimeEnvironment, it is important to ensure
your code is forward-compatible. That is, if a match arm handles a case for a
feature that is supported by the service but has not been represented as an enum
variant in a current version of SDK, your code should continue to work when you
upgrade SDK to a future version in which the enum does include a variant for that
feature.
Here is an example of how you can make a match expression forward-compatible:
# let runtimeenvironment = unimplemented!();
match runtimeenvironment {
RuntimeEnvironment::Flink111 => { /* ... */ },
RuntimeEnvironment::Flink113 => { /* ... */ },
RuntimeEnvironment::Flink115 => { /* ... */ },
RuntimeEnvironment::Flink16 => { /* ... */ },
RuntimeEnvironment::Flink18 => { /* ... */ },
RuntimeEnvironment::Sql10 => { /* ... */ },
RuntimeEnvironment::ZeppelinFlink10 => { /* ... */ },
RuntimeEnvironment::ZeppelinFlink20 => { /* ... */ },
RuntimeEnvironment::ZeppelinFlink30 => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when runtimeenvironment represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant RuntimeEnvironment::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
RuntimeEnvironment::Unknown(UnknownVariantValue("NewFeature".to_owned()))
and calling as_str on it yields "NewFeature".
This match expression is forward-compatible when executed with a newer
version of SDK where the variant RuntimeEnvironment::NewFeature is defined.
Specifically, when runtimeenvironment represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on RuntimeEnvironment::NewFeature also yielding "NewFeature".
Explicitly matching on the Unknown variant should
be avoided for two reasons:
- The inner data
UnknownVariantValueis opaque, and no further information can be extracted. - It might inadvertently shadow other intended match arms.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Flink111
Flink113
Flink115
Flink16
Flink18
Sql10
ZeppelinFlink10
ZeppelinFlink20
ZeppelinFlink30
Unknown(UnknownVariantValue)
Unknown. See the docs on this enum for the correct way to handle unknown variants.Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl RuntimeEnvironment
impl RuntimeEnvironment
sourcepub fn try_parse(value: &str) -> Result<Self, UnknownVariantError>
pub fn try_parse(value: &str) -> Result<Self, UnknownVariantError>
Parses the enum value while disallowing unknown variants.
Unknown variants will result in an error.
Trait Implementations§
source§impl AsRef<str> for RuntimeEnvironment
impl AsRef<str> for RuntimeEnvironment
source§impl Clone for RuntimeEnvironment
impl Clone for RuntimeEnvironment
source§fn clone(&self) -> RuntimeEnvironment
fn clone(&self) -> RuntimeEnvironment
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for RuntimeEnvironment
impl Debug for RuntimeEnvironment
source§impl From<&str> for RuntimeEnvironment
impl From<&str> for RuntimeEnvironment
source§impl FromStr for RuntimeEnvironment
impl FromStr for RuntimeEnvironment
source§impl Hash for RuntimeEnvironment
impl Hash for RuntimeEnvironment
source§impl Ord for RuntimeEnvironment
impl Ord for RuntimeEnvironment
source§fn cmp(&self, other: &RuntimeEnvironment) -> Ordering
fn cmp(&self, other: &RuntimeEnvironment) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq for RuntimeEnvironment
impl PartialEq for RuntimeEnvironment
source§fn eq(&self, other: &RuntimeEnvironment) -> bool
fn eq(&self, other: &RuntimeEnvironment) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd for RuntimeEnvironment
impl PartialOrd for RuntimeEnvironment
source§fn partial_cmp(&self, other: &RuntimeEnvironment) -> Option<Ordering>
fn partial_cmp(&self, other: &RuntimeEnvironment) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for RuntimeEnvironment
impl StructuralEq for RuntimeEnvironment
impl StructuralPartialEq for RuntimeEnvironment
Auto Trait Implementations§
impl RefUnwindSafe for RuntimeEnvironment
impl Send for RuntimeEnvironment
impl Sync for RuntimeEnvironment
impl Unpin for RuntimeEnvironment
impl UnwindSafe for RuntimeEnvironment
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.