Enum aws_sdk_m2::model::EngineType
source · #[non_exhaustive]
pub enum EngineType {
Bluage,
Microfocus,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against EngineType, 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 enginetype = unimplemented!();
match enginetype {
EngineType::Bluage => { /* ... */ },
EngineType::Microfocus => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when enginetype represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant EngineType::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
EngineType::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 EngineType::NewFeature is defined.
Specifically, when enginetype represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on EngineType::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
Bluage
Microfocus
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl EngineType
impl EngineType
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
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
pub fn serialize_structure_crate_input_create_application_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateApplicationInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_1) = &input.client_token {
object.key("clientToken").string(var_1.as_str());
}
if let Some(var_2) = &input.definition {
#[allow(unused_mut)]
let mut object_3 = object.key("definition").start_object();
crate::json_ser::serialize_union_crate_model_definition(&mut object_3, var_2)?;
object_3.finish();
}
if let Some(var_4) = &input.description {
object.key("description").string(var_4.as_str());
}
if let Some(var_5) = &input.engine_type {
object.key("engineType").string(var_5.as_str());
}
if let Some(var_6) = &input.name {
object.key("name").string(var_6.as_str());
}
if let Some(var_7) = &input.tags {
#[allow(unused_mut)]
let mut object_8 = object.key("tags").start_object();
for (key_9, value_10) in var_7 {
{
object_8.key(key_9.as_str()).string(value_10.as_str());
}
}
object_8.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_create_data_set_import_task_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateDataSetImportTaskInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_11) = &input.client_token {
object.key("clientToken").string(var_11.as_str());
}
if let Some(var_12) = &input.import_config {
#[allow(unused_mut)]
let mut object_13 = object.key("importConfig").start_object();
crate::json_ser::serialize_union_crate_model_data_set_import_config(
&mut object_13,
var_12,
)?;
object_13.finish();
}
Ok(())
}
pub fn serialize_structure_crate_input_create_deployment_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateDeploymentInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_14) = &input.application_version {
object.key("applicationVersion").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::NegInt((*var_14).into()),
);
}
if let Some(var_15) = &input.client_token {
object.key("clientToken").string(var_15.as_str());
}
if let Some(var_16) = &input.environment_id {
object.key("environmentId").string(var_16.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_input_create_environment_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateEnvironmentInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_17) = &input.client_token {
object.key("clientToken").string(var_17.as_str());
}
if let Some(var_18) = &input.description {
object.key("description").string(var_18.as_str());
}
if let Some(var_19) = &input.engine_type {
object.key("engineType").string(var_19.as_str());
}
if let Some(var_20) = &input.engine_version {
object.key("engineVersion").string(var_20.as_str());
}
if let Some(var_21) = &input.high_availability_config {
#[allow(unused_mut)]
let mut object_22 = object.key("highAvailabilityConfig").start_object();
crate::json_ser::serialize_structure_crate_model_high_availability_config(
&mut object_22,
var_21,
)?;
object_22.finish();
}
if let Some(var_23) = &input.instance_type {
object.key("instanceType").string(var_23.as_str());
}
if let Some(var_24) = &input.name {
object.key("name").string(var_24.as_str());
}
if let Some(var_25) = &input.preferred_maintenance_window {
object
.key("preferredMaintenanceWindow")
.string(var_25.as_str());
}
if input.publicly_accessible {
object
.key("publiclyAccessible")
.boolean(input.publicly_accessible);
}
if let Some(var_26) = &input.security_group_ids {
let mut array_27 = object.key("securityGroupIds").start_array();
for item_28 in var_26 {
{
array_27.value().string(item_28.as_str());
}
}
array_27.finish();
}
if let Some(var_29) = &input.storage_configurations {
let mut array_30 = object.key("storageConfigurations").start_array();
for item_31 in var_29 {
{
#[allow(unused_mut)]
let mut object_32 = array_30.value().start_object();
crate::json_ser::serialize_union_crate_model_storage_configuration(
&mut object_32,
item_31,
)?;
object_32.finish();
}
}
array_30.finish();
}
if let Some(var_33) = &input.subnet_ids {
let mut array_34 = object.key("subnetIds").start_array();
for item_35 in var_33 {
{
array_34.value().string(item_35.as_str());
}
}
array_34.finish();
}
if let Some(var_36) = &input.tags {
#[allow(unused_mut)]
let mut object_37 = object.key("tags").start_object();
for (key_38, value_39) in var_36 {
{
object_37.key(key_38.as_str()).string(value_39.as_str());
}
}
object_37.finish();
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for EngineType
impl AsRef<str> for EngineType
source§impl Clone for EngineType
impl Clone for EngineType
source§fn clone(&self) -> EngineType
fn clone(&self) -> EngineType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for EngineType
impl Debug for EngineType
source§impl From<&str> for EngineType
impl From<&str> for EngineType
source§impl FromStr for EngineType
impl FromStr for EngineType
source§impl Hash for EngineType
impl Hash for EngineType
source§impl Ord for EngineType
impl Ord for EngineType
source§fn cmp(&self, other: &EngineType) -> Ordering
fn cmp(&self, other: &EngineType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<EngineType> for EngineType
impl PartialEq<EngineType> for EngineType
source§fn eq(&self, other: &EngineType) -> bool
fn eq(&self, other: &EngineType) -> bool
source§impl PartialOrd<EngineType> for EngineType
impl PartialOrd<EngineType> for EngineType
source§fn partial_cmp(&self, other: &EngineType) -> Option<Ordering>
fn partial_cmp(&self, other: &EngineType) -> 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 EngineType
impl StructuralEq for EngineType
impl StructuralPartialEq for EngineType
Auto Trait Implementations§
impl RefUnwindSafe for EngineType
impl Send for EngineType
impl Sync for EngineType
impl Unpin for EngineType
impl UnwindSafe for EngineType
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.