#[non_exhaustive]
pub enum CapacityReservationInstancePlatform {
Show 18 variants LinuxWithSqlServerEnterprise, LinuxWithSqlServerStandard, LinuxWithSqlServerWeb, LinuxUnix, RhelWithHa, RhelWithHaAndSqlServerEnterprise, RhelWithHaAndSqlServerStandard, RhelWithSqlServerEnterprise, RhelWithSqlServerStandard, RhelWithSqlServerWeb, RedHatEnterpriseLinux, SuseLinux, Windows, WindowsWithSqlServer, WindowsWithSqlServerEnterprise, WindowsWithSqlServerStandard, WindowsWithSqlServerWeb, Unknown(UnknownVariantValue),
}
Expand description

When writing a match expression against CapacityReservationInstancePlatform, 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 capacityreservationinstanceplatform = unimplemented!();
match capacityreservationinstanceplatform {
    CapacityReservationInstancePlatform::LinuxWithSqlServerEnterprise => { /* ... */ },
    CapacityReservationInstancePlatform::LinuxWithSqlServerStandard => { /* ... */ },
    CapacityReservationInstancePlatform::LinuxWithSqlServerWeb => { /* ... */ },
    CapacityReservationInstancePlatform::LinuxUnix => { /* ... */ },
    CapacityReservationInstancePlatform::RhelWithHa => { /* ... */ },
    CapacityReservationInstancePlatform::RhelWithHaAndSqlServerEnterprise => { /* ... */ },
    CapacityReservationInstancePlatform::RhelWithHaAndSqlServerStandard => { /* ... */ },
    CapacityReservationInstancePlatform::RhelWithSqlServerEnterprise => { /* ... */ },
    CapacityReservationInstancePlatform::RhelWithSqlServerStandard => { /* ... */ },
    CapacityReservationInstancePlatform::RhelWithSqlServerWeb => { /* ... */ },
    CapacityReservationInstancePlatform::RedHatEnterpriseLinux => { /* ... */ },
    CapacityReservationInstancePlatform::SuseLinux => { /* ... */ },
    CapacityReservationInstancePlatform::Windows => { /* ... */ },
    CapacityReservationInstancePlatform::WindowsWithSqlServer => { /* ... */ },
    CapacityReservationInstancePlatform::WindowsWithSqlServerEnterprise => { /* ... */ },
    CapacityReservationInstancePlatform::WindowsWithSqlServerStandard => { /* ... */ },
    CapacityReservationInstancePlatform::WindowsWithSqlServerWeb => { /* ... */ },
    other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
    _ => { /* ... */ },
}

The above code demonstrates that when capacityreservationinstanceplatform represents NewFeature, the execution path will lead to the second last match arm, even though the enum does not contain a variant CapacityReservationInstancePlatform::NewFeature in the current version of SDK. The reason is that the variable other, created by the @ operator, is bound to CapacityReservationInstancePlatform::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 CapacityReservationInstancePlatform::NewFeature is defined. Specifically, when capacityreservationinstanceplatform represents NewFeature, the execution path will hit the second last match arm as before by virtue of calling as_str on CapacityReservationInstancePlatform::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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

LinuxWithSqlServerEnterprise

§

LinuxWithSqlServerStandard

§

LinuxWithSqlServerWeb

§

LinuxUnix

§

RhelWithHa

§

RhelWithHaAndSqlServerEnterprise

§

RhelWithHaAndSqlServerStandard

§

RhelWithSqlServerEnterprise

§

RhelWithSqlServerStandard

§

RhelWithSqlServerWeb

§

RedHatEnterpriseLinux

§

SuseLinux

§

Windows

§

WindowsWithSqlServer

§

WindowsWithSqlServerEnterprise

§

WindowsWithSqlServerStandard

§

WindowsWithSqlServerWeb

§

Unknown(UnknownVariantValue)

Unknown contains new variants that have been added since this code was generated.

Implementations§

Returns the &str value of the enum member.

Examples found in repository?
src/model.rs (line 112132)
112131
112132
112133
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/query_ser.rs (line 207)
195
196
197
198
199
200
201
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
pub fn serialize_structure_crate_model_reservation_fleet_instance_specification(
    mut writer: aws_smithy_query::QueryValueWriter,
    input: &crate::model::ReservationFleetInstanceSpecification,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    #[allow(unused_mut)]
    let mut scope_59 = writer.prefix("InstanceType");
    if let Some(var_60) = &input.instance_type {
        scope_59.string(var_60.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_61 = writer.prefix("InstancePlatform");
    if let Some(var_62) = &input.instance_platform {
        scope_61.string(var_62.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_63 = writer.prefix("Weight");
    if let Some(var_64) = &input.weight {
        scope_63.number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::Float((*var_64).into()),
        );
    }
    #[allow(unused_mut)]
    let mut scope_65 = writer.prefix("AvailabilityZone");
    if let Some(var_66) = &input.availability_zone {
        scope_65.string(var_66);
    }
    #[allow(unused_mut)]
    let mut scope_67 = writer.prefix("AvailabilityZoneId");
    if let Some(var_68) = &input.availability_zone_id {
        scope_67.string(var_68);
    }
    #[allow(unused_mut)]
    let mut scope_69 = writer.prefix("EbsOptimized");
    if let Some(var_70) = &input.ebs_optimized {
        scope_69.boolean(*var_70);
    }
    #[allow(unused_mut)]
    let mut scope_71 = writer.prefix("Priority");
    if let Some(var_72) = &input.priority {
        scope_71.number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_72).into()),
        );
    }
    Ok(())
}
src/operation_ser.rs (line 1804)
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
pub fn serialize_operation_crate_operation_create_capacity_reservation(
    input: &crate::input::CreateCapacityReservationInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::error::SerializationError> {
    let mut out = String::new();
    #[allow(unused_mut)]
    let mut writer =
        aws_smithy_query::QueryWriter::new(&mut out, "CreateCapacityReservation", "2016-11-15");
    #[allow(unused_mut)]
    let mut scope_483 = writer.prefix("ClientToken");
    if let Some(var_484) = &input.client_token {
        scope_483.string(var_484);
    }
    #[allow(unused_mut)]
    let mut scope_485 = writer.prefix("InstanceType");
    if let Some(var_486) = &input.instance_type {
        scope_485.string(var_486);
    }
    #[allow(unused_mut)]
    let mut scope_487 = writer.prefix("InstancePlatform");
    if let Some(var_488) = &input.instance_platform {
        scope_487.string(var_488.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_489 = writer.prefix("AvailabilityZone");
    if let Some(var_490) = &input.availability_zone {
        scope_489.string(var_490);
    }
    #[allow(unused_mut)]
    let mut scope_491 = writer.prefix("AvailabilityZoneId");
    if let Some(var_492) = &input.availability_zone_id {
        scope_491.string(var_492);
    }
    #[allow(unused_mut)]
    let mut scope_493 = writer.prefix("Tenancy");
    if let Some(var_494) = &input.tenancy {
        scope_493.string(var_494.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_495 = writer.prefix("InstanceCount");
    if let Some(var_496) = &input.instance_count {
        scope_495.number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_496).into()),
        );
    }
    #[allow(unused_mut)]
    let mut scope_497 = writer.prefix("EbsOptimized");
    if let Some(var_498) = &input.ebs_optimized {
        scope_497.boolean(*var_498);
    }
    #[allow(unused_mut)]
    let mut scope_499 = writer.prefix("EphemeralStorage");
    if let Some(var_500) = &input.ephemeral_storage {
        scope_499.boolean(*var_500);
    }
    #[allow(unused_mut)]
    let mut scope_501 = writer.prefix("EndDate");
    if let Some(var_502) = &input.end_date {
        scope_501.date_time(var_502, aws_smithy_types::date_time::Format::DateTime)?;
    }
    #[allow(unused_mut)]
    let mut scope_503 = writer.prefix("EndDateType");
    if let Some(var_504) = &input.end_date_type {
        scope_503.string(var_504.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_505 = writer.prefix("InstanceMatchCriteria");
    if let Some(var_506) = &input.instance_match_criteria {
        scope_505.string(var_506.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_507 = writer.prefix("TagSpecifications");
    if let Some(var_508) = &input.tag_specifications {
        let mut list_510 = scope_507.start_list(true, Some("item"));
        for item_509 in var_508 {
            #[allow(unused_mut)]
            let mut entry_511 = list_510.entry();
            crate::query_ser::serialize_structure_crate_model_tag_specification(
                entry_511, item_509,
            )?;
        }
        list_510.finish();
    }
    #[allow(unused_mut)]
    let mut scope_512 = writer.prefix("DryRun");
    if let Some(var_513) = &input.dry_run {
        scope_512.boolean(*var_513);
    }
    #[allow(unused_mut)]
    let mut scope_514 = writer.prefix("OutpostArn");
    if let Some(var_515) = &input.outpost_arn {
        scope_514.string(var_515);
    }
    #[allow(unused_mut)]
    let mut scope_516 = writer.prefix("PlacementGroupArn");
    if let Some(var_517) = &input.placement_group_arn {
        scope_516.string(var_517);
    }
    writer.finish();
    Ok(aws_smithy_http::body::SdkBody::from(out))
}

Returns all the &str values of the enum members.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more