Enum aws_sdk_appstream::model::FleetType
source · #[non_exhaustive]
pub enum FleetType {
AlwaysOn,
Elastic,
OnDemand,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against FleetType
, 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 fleettype = unimplemented!();
match fleettype {
FleetType::AlwaysOn => { /* ... */ },
FleetType::Elastic => { /* ... */ },
FleetType::OnDemand => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when fleettype
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant FleetType::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
FleetType::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 FleetType::NewFeature
is defined.
Specifically, when fleettype
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on FleetType::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
AlwaysOn
Elastic
OnDemand
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl FleetType
impl FleetType
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
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 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
pub fn serialize_structure_crate_input_create_fleet_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateFleetInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_64) = &input.name {
object.key("Name").string(var_64.as_str());
}
if let Some(var_65) = &input.image_name {
object.key("ImageName").string(var_65.as_str());
}
if let Some(var_66) = &input.image_arn {
object.key("ImageArn").string(var_66.as_str());
}
if let Some(var_67) = &input.instance_type {
object.key("InstanceType").string(var_67.as_str());
}
if let Some(var_68) = &input.fleet_type {
object.key("FleetType").string(var_68.as_str());
}
if let Some(var_69) = &input.compute_capacity {
#[allow(unused_mut)]
let mut object_70 = object.key("ComputeCapacity").start_object();
crate::json_ser::serialize_structure_crate_model_compute_capacity(&mut object_70, var_69)?;
object_70.finish();
}
if let Some(var_71) = &input.vpc_config {
#[allow(unused_mut)]
let mut object_72 = object.key("VpcConfig").start_object();
crate::json_ser::serialize_structure_crate_model_vpc_config(&mut object_72, var_71)?;
object_72.finish();
}
if let Some(var_73) = &input.max_user_duration_in_seconds {
object.key("MaxUserDurationInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_73).into()),
);
}
if let Some(var_74) = &input.disconnect_timeout_in_seconds {
object.key("DisconnectTimeoutInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_74).into()),
);
}
if let Some(var_75) = &input.description {
object.key("Description").string(var_75.as_str());
}
if let Some(var_76) = &input.display_name {
object.key("DisplayName").string(var_76.as_str());
}
if let Some(var_77) = &input.enable_default_internet_access {
object.key("EnableDefaultInternetAccess").boolean(*var_77);
}
if let Some(var_78) = &input.domain_join_info {
#[allow(unused_mut)]
let mut object_79 = object.key("DomainJoinInfo").start_object();
crate::json_ser::serialize_structure_crate_model_domain_join_info(&mut object_79, var_78)?;
object_79.finish();
}
if let Some(var_80) = &input.tags {
#[allow(unused_mut)]
let mut object_81 = object.key("Tags").start_object();
for (key_82, value_83) in var_80 {
{
object_81.key(key_82.as_str()).string(value_83.as_str());
}
}
object_81.finish();
}
if let Some(var_84) = &input.idle_disconnect_timeout_in_seconds {
object.key("IdleDisconnectTimeoutInSeconds").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_84).into()),
);
}
if let Some(var_85) = &input.iam_role_arn {
object.key("IamRoleArn").string(var_85.as_str());
}
if let Some(var_86) = &input.stream_view {
object.key("StreamView").string(var_86.as_str());
}
if let Some(var_87) = &input.platform {
object.key("Platform").string(var_87.as_str());
}
if let Some(var_88) = &input.max_concurrent_sessions {
object.key("MaxConcurrentSessions").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_88).into()),
);
}
if let Some(var_89) = &input.usb_device_filter_strings {
let mut array_90 = object.key("UsbDeviceFilterStrings").start_array();
for item_91 in var_89 {
{
array_90.value().string(item_91.as_str());
}
}
array_90.finish();
}
if let Some(var_92) = &input.session_script_s3_location {
#[allow(unused_mut)]
let mut object_93 = object.key("SessionScriptS3Location").start_object();
crate::json_ser::serialize_structure_crate_model_s3_location(&mut object_93, var_92)?;
object_93.finish();
}
Ok(())
}
Trait Implementations§
source§impl Ord for FleetType
impl Ord for FleetType
source§impl PartialOrd<FleetType> for FleetType
impl PartialOrd<FleetType> for FleetType
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 FleetType
impl StructuralEq for FleetType
impl StructuralPartialEq for FleetType
Auto Trait Implementations§
impl RefUnwindSafe for FleetType
impl Send for FleetType
impl Sync for FleetType
impl Unpin for FleetType
impl UnwindSafe for FleetType
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.