#[non_exhaustive]
pub enum ReturnValuesOnConditionCheckFailure {
    AllOld,
    None,
    Unknown(UnknownVariantValue),
}
Expand description

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

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

AllOld

§

None

§

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 10702)
10701
10702
10703
    fn as_ref(&self) -> &str {
        self.as_str()
    }
More examples
Hide additional examples
src/json_ser.rs (line 2864)
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
pub fn serialize_structure_crate_model_condition_check(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ConditionCheck,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_610) = &input.key {
        #[allow(unused_mut)]
        let mut object_611 = object.key("Key").start_object();
        for (key_612, value_613) in var_610 {
            {
                #[allow(unused_mut)]
                let mut object_614 = object_611.key(key_612.as_str()).start_object();
                crate::json_ser::serialize_union_crate_model_attribute_value(
                    &mut object_614,
                    value_613,
                )?;
                object_614.finish();
            }
        }
        object_611.finish();
    }
    if let Some(var_615) = &input.table_name {
        object.key("TableName").string(var_615.as_str());
    }
    if let Some(var_616) = &input.condition_expression {
        object.key("ConditionExpression").string(var_616.as_str());
    }
    if let Some(var_617) = &input.expression_attribute_names {
        #[allow(unused_mut)]
        let mut object_618 = object.key("ExpressionAttributeNames").start_object();
        for (key_619, value_620) in var_617 {
            {
                object_618.key(key_619.as_str()).string(value_620.as_str());
            }
        }
        object_618.finish();
    }
    if let Some(var_621) = &input.expression_attribute_values {
        #[allow(unused_mut)]
        let mut object_622 = object.key("ExpressionAttributeValues").start_object();
        for (key_623, value_624) in var_621 {
            {
                #[allow(unused_mut)]
                let mut object_625 = object_622.key(key_623.as_str()).start_object();
                crate::json_ser::serialize_union_crate_model_attribute_value(
                    &mut object_625,
                    value_624,
                )?;
                object_625.finish();
            }
        }
        object_622.finish();
    }
    if let Some(var_626) = &input.return_values_on_condition_check_failure {
        object
            .key("ReturnValuesOnConditionCheckFailure")
            .string(var_626.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_put(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Put,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_627) = &input.item {
        #[allow(unused_mut)]
        let mut object_628 = object.key("Item").start_object();
        for (key_629, value_630) in var_627 {
            {
                #[allow(unused_mut)]
                let mut object_631 = object_628.key(key_629.as_str()).start_object();
                crate::json_ser::serialize_union_crate_model_attribute_value(
                    &mut object_631,
                    value_630,
                )?;
                object_631.finish();
            }
        }
        object_628.finish();
    }
    if let Some(var_632) = &input.table_name {
        object.key("TableName").string(var_632.as_str());
    }
    if let Some(var_633) = &input.condition_expression {
        object.key("ConditionExpression").string(var_633.as_str());
    }
    if let Some(var_634) = &input.expression_attribute_names {
        #[allow(unused_mut)]
        let mut object_635 = object.key("ExpressionAttributeNames").start_object();
        for (key_636, value_637) in var_634 {
            {
                object_635.key(key_636.as_str()).string(value_637.as_str());
            }
        }
        object_635.finish();
    }
    if let Some(var_638) = &input.expression_attribute_values {
        #[allow(unused_mut)]
        let mut object_639 = object.key("ExpressionAttributeValues").start_object();
        for (key_640, value_641) in var_638 {
            {
                #[allow(unused_mut)]
                let mut object_642 = object_639.key(key_640.as_str()).start_object();
                crate::json_ser::serialize_union_crate_model_attribute_value(
                    &mut object_642,
                    value_641,
                )?;
                object_642.finish();
            }
        }
        object_639.finish();
    }
    if let Some(var_643) = &input.return_values_on_condition_check_failure {
        object
            .key("ReturnValuesOnConditionCheckFailure")
            .string(var_643.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_delete(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Delete,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_644) = &input.key {
        #[allow(unused_mut)]
        let mut object_645 = object.key("Key").start_object();
        for (key_646, value_647) in var_644 {
            {
                #[allow(unused_mut)]
                let mut object_648 = object_645.key(key_646.as_str()).start_object();
                crate::json_ser::serialize_union_crate_model_attribute_value(
                    &mut object_648,
                    value_647,
                )?;
                object_648.finish();
            }
        }
        object_645.finish();
    }
    if let Some(var_649) = &input.table_name {
        object.key("TableName").string(var_649.as_str());
    }
    if let Some(var_650) = &input.condition_expression {
        object.key("ConditionExpression").string(var_650.as_str());
    }
    if let Some(var_651) = &input.expression_attribute_names {
        #[allow(unused_mut)]
        let mut object_652 = object.key("ExpressionAttributeNames").start_object();
        for (key_653, value_654) in var_651 {
            {
                object_652.key(key_653.as_str()).string(value_654.as_str());
            }
        }
        object_652.finish();
    }
    if let Some(var_655) = &input.expression_attribute_values {
        #[allow(unused_mut)]
        let mut object_656 = object.key("ExpressionAttributeValues").start_object();
        for (key_657, value_658) in var_655 {
            {
                #[allow(unused_mut)]
                let mut object_659 = object_656.key(key_657.as_str()).start_object();
                crate::json_ser::serialize_union_crate_model_attribute_value(
                    &mut object_659,
                    value_658,
                )?;
                object_659.finish();
            }
        }
        object_656.finish();
    }
    if let Some(var_660) = &input.return_values_on_condition_check_failure {
        object
            .key("ReturnValuesOnConditionCheckFailure")
            .string(var_660.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Update,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
    if let Some(var_661) = &input.key {
        #[allow(unused_mut)]
        let mut object_662 = object.key("Key").start_object();
        for (key_663, value_664) in var_661 {
            {
                #[allow(unused_mut)]
                let mut object_665 = object_662.key(key_663.as_str()).start_object();
                crate::json_ser::serialize_union_crate_model_attribute_value(
                    &mut object_665,
                    value_664,
                )?;
                object_665.finish();
            }
        }
        object_662.finish();
    }
    if let Some(var_666) = &input.update_expression {
        object.key("UpdateExpression").string(var_666.as_str());
    }
    if let Some(var_667) = &input.table_name {
        object.key("TableName").string(var_667.as_str());
    }
    if let Some(var_668) = &input.condition_expression {
        object.key("ConditionExpression").string(var_668.as_str());
    }
    if let Some(var_669) = &input.expression_attribute_names {
        #[allow(unused_mut)]
        let mut object_670 = object.key("ExpressionAttributeNames").start_object();
        for (key_671, value_672) in var_669 {
            {
                object_670.key(key_671.as_str()).string(value_672.as_str());
            }
        }
        object_670.finish();
    }
    if let Some(var_673) = &input.expression_attribute_values {
        #[allow(unused_mut)]
        let mut object_674 = object.key("ExpressionAttributeValues").start_object();
        for (key_675, value_676) in var_673 {
            {
                #[allow(unused_mut)]
                let mut object_677 = object_674.key(key_675.as_str()).start_object();
                crate::json_ser::serialize_union_crate_model_attribute_value(
                    &mut object_677,
                    value_676,
                )?;
                object_677.finish();
            }
        }
        object_674.finish();
    }
    if let Some(var_678) = &input.return_values_on_condition_check_failure {
        object
            .key("ReturnValuesOnConditionCheckFailure")
            .string(var_678.as_str());
    }
    Ok(())
}

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