#[non_exhaustive]
pub enum ServiceUpdateStatus {
    Available,
    Cancelled,
    Expired,
    Unknown(UnknownVariantValue),
}
Expand description

When writing a match expression against ServiceUpdateStatus, 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 serviceupdatestatus = unimplemented!();
match serviceupdatestatus {
    ServiceUpdateStatus::Available => { /* ... */ },
    ServiceUpdateStatus::Cancelled => { /* ... */ },
    ServiceUpdateStatus::Expired => { /* ... */ },
    other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
    _ => { /* ... */ },
}

The above code demonstrates that when serviceupdatestatus represents NewFeature, the execution path will lead to the second last match arm, even though the enum does not contain a variant ServiceUpdateStatus::NewFeature in the current version of SDK. The reason is that the variable other, created by the @ operator, is bound to ServiceUpdateStatus::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 ServiceUpdateStatus::NewFeature is defined. Specifically, when serviceupdatestatus represents NewFeature, the execution path will hit the second last match arm as before by virtue of calling as_str on ServiceUpdateStatus::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.
§

Available

§

Cancelled

§

Expired

§

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 9395)
9394
9395
9396
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/operation_ser.rs (line 1670)
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
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
pub fn serialize_operation_crate_operation_describe_service_updates(
    input: &crate::input::DescribeServiceUpdatesInput,
) -> 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, "DescribeServiceUpdates", "2015-02-02");
    #[allow(unused_mut)]
    let mut scope_475 = writer.prefix("ServiceUpdateName");
    if let Some(var_476) = &input.service_update_name {
        scope_475.string(var_476);
    }
    #[allow(unused_mut)]
    let mut scope_477 = writer.prefix("ServiceUpdateStatus");
    if let Some(var_478) = &input.service_update_status {
        let mut list_480 = scope_477.start_list(false, None);
        for item_479 in var_478 {
            #[allow(unused_mut)]
            let mut entry_481 = list_480.entry();
            entry_481.string(item_479.as_str());
        }
        list_480.finish();
    }
    #[allow(unused_mut)]
    let mut scope_482 = writer.prefix("MaxRecords");
    if let Some(var_483) = &input.max_records {
        scope_482.number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_483).into()),
        );
    }
    #[allow(unused_mut)]
    let mut scope_484 = writer.prefix("Marker");
    if let Some(var_485) = &input.marker {
        scope_484.string(var_485);
    }
    writer.finish();
    Ok(aws_smithy_http::body::SdkBody::from(out))
}

pub fn serialize_operation_crate_operation_describe_snapshots(
    input: &crate::input::DescribeSnapshotsInput,
) -> 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, "DescribeSnapshots", "2015-02-02");
    #[allow(unused_mut)]
    let mut scope_486 = writer.prefix("ReplicationGroupId");
    if let Some(var_487) = &input.replication_group_id {
        scope_486.string(var_487);
    }
    #[allow(unused_mut)]
    let mut scope_488 = writer.prefix("CacheClusterId");
    if let Some(var_489) = &input.cache_cluster_id {
        scope_488.string(var_489);
    }
    #[allow(unused_mut)]
    let mut scope_490 = writer.prefix("SnapshotName");
    if let Some(var_491) = &input.snapshot_name {
        scope_490.string(var_491);
    }
    #[allow(unused_mut)]
    let mut scope_492 = writer.prefix("SnapshotSource");
    if let Some(var_493) = &input.snapshot_source {
        scope_492.string(var_493);
    }
    #[allow(unused_mut)]
    let mut scope_494 = writer.prefix("Marker");
    if let Some(var_495) = &input.marker {
        scope_494.string(var_495);
    }
    #[allow(unused_mut)]
    let mut scope_496 = writer.prefix("MaxRecords");
    if let Some(var_497) = &input.max_records {
        scope_496.number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_497).into()),
        );
    }
    #[allow(unused_mut)]
    let mut scope_498 = writer.prefix("ShowNodeGroupConfig");
    if let Some(var_499) = &input.show_node_group_config {
        scope_498.boolean(*var_499);
    }
    writer.finish();
    Ok(aws_smithy_http::body::SdkBody::from(out))
}

pub fn serialize_operation_crate_operation_describe_update_actions(
    input: &crate::input::DescribeUpdateActionsInput,
) -> 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, "DescribeUpdateActions", "2015-02-02");
    #[allow(unused_mut)]
    let mut scope_500 = writer.prefix("ServiceUpdateName");
    if let Some(var_501) = &input.service_update_name {
        scope_500.string(var_501);
    }
    #[allow(unused_mut)]
    let mut scope_502 = writer.prefix("ReplicationGroupIds");
    if let Some(var_503) = &input.replication_group_ids {
        let mut list_505 = scope_502.start_list(false, None);
        for item_504 in var_503 {
            #[allow(unused_mut)]
            let mut entry_506 = list_505.entry();
            entry_506.string(item_504);
        }
        list_505.finish();
    }
    #[allow(unused_mut)]
    let mut scope_507 = writer.prefix("CacheClusterIds");
    if let Some(var_508) = &input.cache_cluster_ids {
        let mut list_510 = scope_507.start_list(false, None);
        for item_509 in var_508 {
            #[allow(unused_mut)]
            let mut entry_511 = list_510.entry();
            entry_511.string(item_509);
        }
        list_510.finish();
    }
    #[allow(unused_mut)]
    let mut scope_512 = writer.prefix("Engine");
    if let Some(var_513) = &input.engine {
        scope_512.string(var_513);
    }
    #[allow(unused_mut)]
    let mut scope_514 = writer.prefix("ServiceUpdateStatus");
    if let Some(var_515) = &input.service_update_status {
        let mut list_517 = scope_514.start_list(false, None);
        for item_516 in var_515 {
            #[allow(unused_mut)]
            let mut entry_518 = list_517.entry();
            entry_518.string(item_516.as_str());
        }
        list_517.finish();
    }
    #[allow(unused_mut)]
    let mut scope_519 = writer.prefix("ServiceUpdateTimeRange");
    if let Some(var_520) = &input.service_update_time_range {
        crate::query_ser::serialize_structure_crate_model_time_range_filter(scope_519, var_520)?;
    }
    #[allow(unused_mut)]
    let mut scope_521 = writer.prefix("UpdateActionStatus");
    if let Some(var_522) = &input.update_action_status {
        let mut list_524 = scope_521.start_list(false, None);
        for item_523 in var_522 {
            #[allow(unused_mut)]
            let mut entry_525 = list_524.entry();
            entry_525.string(item_523.as_str());
        }
        list_524.finish();
    }
    #[allow(unused_mut)]
    let mut scope_526 = writer.prefix("ShowNodeLevelUpdateStatus");
    if let Some(var_527) = &input.show_node_level_update_status {
        scope_526.boolean(*var_527);
    }
    #[allow(unused_mut)]
    let mut scope_528 = writer.prefix("MaxRecords");
    if let Some(var_529) = &input.max_records {
        scope_528.number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_529).into()),
        );
    }
    #[allow(unused_mut)]
    let mut scope_530 = writer.prefix("Marker");
    if let Some(var_531) = &input.marker {
        scope_530.string(var_531);
    }
    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