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