Enum aws_sdk_outposts::model::UplinkCount
source · #[non_exhaustive]
pub enum UplinkCount {
UplinkCount1,
UplinkCount12,
UplinkCount16,
UplinkCount2,
UplinkCount3,
UplinkCount4,
UplinkCount5,
UplinkCount6,
UplinkCount7,
UplinkCount8,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against UplinkCount
, 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 uplinkcount = unimplemented!();
match uplinkcount {
UplinkCount::UplinkCount1 => { /* ... */ },
UplinkCount::UplinkCount12 => { /* ... */ },
UplinkCount::UplinkCount16 => { /* ... */ },
UplinkCount::UplinkCount2 => { /* ... */ },
UplinkCount::UplinkCount3 => { /* ... */ },
UplinkCount::UplinkCount4 => { /* ... */ },
UplinkCount::UplinkCount5 => { /* ... */ },
UplinkCount::UplinkCount6 => { /* ... */ },
UplinkCount::UplinkCount7 => { /* ... */ },
UplinkCount::UplinkCount8 => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when uplinkcount
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant UplinkCount::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
UplinkCount::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 UplinkCount::NewFeature
is defined.
Specifically, when uplinkcount
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on UplinkCount::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
UplinkCount1
UplinkCount12
UplinkCount16
UplinkCount2
UplinkCount3
UplinkCount4
UplinkCount5
UplinkCount6
UplinkCount7
UplinkCount8
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl UplinkCount
impl UplinkCount
sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Returns the &str
value of the enum member.
Examples found in repository?
More examples
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
pub fn serialize_structure_crate_input_update_site_rack_physical_properties_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::UpdateSiteRackPhysicalPropertiesInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_47) = &input.fiber_optic_cable_type {
object.key("FiberOpticCableType").string(var_47.as_str());
}
if let Some(var_48) = &input.maximum_supported_weight_lbs {
object
.key("MaximumSupportedWeightLbs")
.string(var_48.as_str());
}
if let Some(var_49) = &input.optical_standard {
object.key("OpticalStandard").string(var_49.as_str());
}
if let Some(var_50) = &input.power_connector {
object.key("PowerConnector").string(var_50.as_str());
}
if let Some(var_51) = &input.power_draw_kva {
object.key("PowerDrawKva").string(var_51.as_str());
}
if let Some(var_52) = &input.power_feed_drop {
object.key("PowerFeedDrop").string(var_52.as_str());
}
if let Some(var_53) = &input.power_phase {
object.key("PowerPhase").string(var_53.as_str());
}
if let Some(var_54) = &input.uplink_count {
object.key("UplinkCount").string(var_54.as_str());
}
if let Some(var_55) = &input.uplink_gbps {
object.key("UplinkGbps").string(var_55.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_line_item_request(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::LineItemRequest,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_56) = &input.catalog_item_id {
object.key("CatalogItemId").string(var_56.as_str());
}
if input.quantity != 0 {
object.key("Quantity").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((input.quantity).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_model_address(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::Address,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_57) = &input.contact_name {
object.key("ContactName").string(var_57.as_str());
}
if let Some(var_58) = &input.contact_phone_number {
object.key("ContactPhoneNumber").string(var_58.as_str());
}
if let Some(var_59) = &input.address_line1 {
object.key("AddressLine1").string(var_59.as_str());
}
if let Some(var_60) = &input.address_line2 {
object.key("AddressLine2").string(var_60.as_str());
}
if let Some(var_61) = &input.address_line3 {
object.key("AddressLine3").string(var_61.as_str());
}
if let Some(var_62) = &input.city {
object.key("City").string(var_62.as_str());
}
if let Some(var_63) = &input.state_or_region {
object.key("StateOrRegion").string(var_63.as_str());
}
if let Some(var_64) = &input.district_or_county {
object.key("DistrictOrCounty").string(var_64.as_str());
}
if let Some(var_65) = &input.postal_code {
object.key("PostalCode").string(var_65.as_str());
}
if let Some(var_66) = &input.country_code {
object.key("CountryCode").string(var_66.as_str());
}
if let Some(var_67) = &input.municipality {
object.key("Municipality").string(var_67.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_rack_physical_properties(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::RackPhysicalProperties,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_68) = &input.power_draw_kva {
object.key("PowerDrawKva").string(var_68.as_str());
}
if let Some(var_69) = &input.power_phase {
object.key("PowerPhase").string(var_69.as_str());
}
if let Some(var_70) = &input.power_connector {
object.key("PowerConnector").string(var_70.as_str());
}
if let Some(var_71) = &input.power_feed_drop {
object.key("PowerFeedDrop").string(var_71.as_str());
}
if let Some(var_72) = &input.uplink_gbps {
object.key("UplinkGbps").string(var_72.as_str());
}
if let Some(var_73) = &input.uplink_count {
object.key("UplinkCount").string(var_73.as_str());
}
if let Some(var_74) = &input.fiber_optic_cable_type {
object.key("FiberOpticCableType").string(var_74.as_str());
}
if let Some(var_75) = &input.optical_standard {
object.key("OpticalStandard").string(var_75.as_str());
}
if let Some(var_76) = &input.maximum_supported_weight_lbs {
object
.key("MaximumSupportedWeightLbs")
.string(var_76.as_str());
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for UplinkCount
impl AsRef<str> for UplinkCount
source§impl Clone for UplinkCount
impl Clone for UplinkCount
source§fn clone(&self) -> UplinkCount
fn clone(&self) -> UplinkCount
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for UplinkCount
impl Debug for UplinkCount
source§impl From<&str> for UplinkCount
impl From<&str> for UplinkCount
source§impl FromStr for UplinkCount
impl FromStr for UplinkCount
source§impl Hash for UplinkCount
impl Hash for UplinkCount
source§impl Ord for UplinkCount
impl Ord for UplinkCount
source§fn cmp(&self, other: &UplinkCount) -> Ordering
fn cmp(&self, other: &UplinkCount) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<UplinkCount> for UplinkCount
impl PartialEq<UplinkCount> for UplinkCount
source§fn eq(&self, other: &UplinkCount) -> bool
fn eq(&self, other: &UplinkCount) -> bool
source§impl PartialOrd<UplinkCount> for UplinkCount
impl PartialOrd<UplinkCount> for UplinkCount
source§fn partial_cmp(&self, other: &UplinkCount) -> Option<Ordering>
fn partial_cmp(&self, other: &UplinkCount) -> 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 UplinkCount
impl StructuralEq for UplinkCount
impl StructuralPartialEq for UplinkCount
Auto Trait Implementations§
impl RefUnwindSafe for UplinkCount
impl Send for UplinkCount
impl Sync for UplinkCount
impl Unpin for UplinkCount
impl UnwindSafe for UplinkCount
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.