Enum aws_sdk_outposts::model::PowerConnector
source · #[non_exhaustive]
pub enum PowerConnector {
Ah530P7W,
Ah532P6W,
Iec309,
L630P,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against PowerConnector
, 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 powerconnector = unimplemented!();
match powerconnector {
PowerConnector::Ah530P7W => { /* ... */ },
PowerConnector::Ah532P6W => { /* ... */ },
PowerConnector::Iec309 => { /* ... */ },
PowerConnector::L630P => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when powerconnector
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant PowerConnector::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
PowerConnector::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 PowerConnector::NewFeature
is defined.
Specifically, when powerconnector
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on PowerConnector::NewFeature
also yielding "NewFeature"
.
Explicitly matching on the Unknown
variant should
be avoided for two reasons:
- The inner data
UnknownVariantValue
is 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
Ah530P7W
Ah532P6W
Iec309
L630P
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
Trait Implementations§
source§impl AsRef<str> for PowerConnector
impl AsRef<str> for PowerConnector
source§impl Clone for PowerConnector
impl Clone for PowerConnector
source§fn clone(&self) -> PowerConnector
fn clone(&self) -> PowerConnector
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PowerConnector
impl Debug for PowerConnector
source§impl From<&str> for PowerConnector
impl From<&str> for PowerConnector
source§impl FromStr for PowerConnector
impl FromStr for PowerConnector
source§impl Hash for PowerConnector
impl Hash for PowerConnector
source§impl Ord for PowerConnector
impl Ord for PowerConnector
source§fn cmp(&self, other: &PowerConnector) -> Ordering
fn cmp(&self, other: &PowerConnector) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<PowerConnector> for PowerConnector
impl PartialEq<PowerConnector> for PowerConnector
source§fn eq(&self, other: &PowerConnector) -> bool
fn eq(&self, other: &PowerConnector) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<PowerConnector> for PowerConnector
impl PartialOrd<PowerConnector> for PowerConnector
source§fn partial_cmp(&self, other: &PowerConnector) -> Option<Ordering>
fn partial_cmp(&self, other: &PowerConnector) -> 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 PowerConnector
impl StructuralEq for PowerConnector
impl StructuralPartialEq for PowerConnector
Auto Trait Implementations§
impl RefUnwindSafe for PowerConnector
impl Send for PowerConnector
impl Sync for PowerConnector
impl Unpin for PowerConnector
impl UnwindSafe for PowerConnector
Blanket Implementations§
source§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,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.