#[non_exhaustive]
pub enum DeliveryMethod {
Email,
Sms,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against DeliveryMethod, 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 deliverymethod = unimplemented!();
match deliverymethod {
DeliveryMethod::Email => { /* ... */ },
DeliveryMethod::Sms => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when deliverymethod represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant DeliveryMethod::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
DeliveryMethod::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 DeliveryMethod::NewFeature is defined.
Specifically, when deliverymethod represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on DeliveryMethod::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.
The type of verification message to send.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Sms
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl DeliveryMethod
impl DeliveryMethod
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
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
pub fn serialize_structure_crate_model_create_backend_auth_forgot_password_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendAuthForgotPasswordConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_136) = &input.delivery_method {
object.key("deliveryMethod").string(var_136.as_str());
}
if let Some(var_137) = &input.email_settings {
#[allow(unused_mut)]
let mut object_138 = object.key("emailSettings").start_object();
crate::json_ser::serialize_structure_crate_model_email_settings(&mut object_138, var_137)?;
object_138.finish();
}
if let Some(var_139) = &input.sms_settings {
#[allow(unused_mut)]
let mut object_140 = object.key("smsSettings").start_object();
crate::json_ser::serialize_structure_crate_model_sms_settings(&mut object_140, var_139)?;
object_140.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_create_backend_auth_mfa_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendAuthMfaConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_141) = &input.mfa_mode {
object.key("MFAMode").string(var_141.as_str());
}
if let Some(var_142) = &input.settings {
#[allow(unused_mut)]
let mut object_143 = object.key("settings").start_object();
crate::json_ser::serialize_structure_crate_model_settings(&mut object_143, var_142)?;
object_143.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_create_backend_auth_o_auth_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendAuthOAuthConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_144) = &input.domain_prefix {
object.key("domainPrefix").string(var_144.as_str());
}
if let Some(var_145) = &input.o_auth_grant_type {
object.key("oAuthGrantType").string(var_145.as_str());
}
if let Some(var_146) = &input.o_auth_scopes {
let mut array_147 = object.key("oAuthScopes").start_array();
for item_148 in var_146 {
{
array_147.value().string(item_148.as_str());
}
}
array_147.finish();
}
if let Some(var_149) = &input.redirect_sign_in_ur_is {
let mut array_150 = object.key("redirectSignInURIs").start_array();
for item_151 in var_149 {
{
array_150.value().string(item_151.as_str());
}
}
array_150.finish();
}
if let Some(var_152) = &input.redirect_sign_out_ur_is {
let mut array_153 = object.key("redirectSignOutURIs").start_array();
for item_154 in var_152 {
{
array_153.value().string(item_154.as_str());
}
}
array_153.finish();
}
if let Some(var_155) = &input.social_provider_settings {
#[allow(unused_mut)]
let mut object_156 = object.key("socialProviderSettings").start_object();
crate::json_ser::serialize_structure_crate_model_social_provider_settings(
&mut object_156,
var_155,
)?;
object_156.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_create_backend_auth_password_policy_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendAuthPasswordPolicyConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_157) = &input.additional_constraints {
let mut array_158 = object.key("additionalConstraints").start_array();
for item_159 in var_157 {
{
array_158.value().string(item_159.as_str());
}
}
array_158.finish();
}
{
object.key("minimumLength").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::Float((input.minimum_length).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_model_create_backend_auth_verification_message_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendAuthVerificationMessageConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_160) = &input.delivery_method {
object.key("deliveryMethod").string(var_160.as_str());
}
if let Some(var_161) = &input.email_settings {
#[allow(unused_mut)]
let mut object_162 = object.key("emailSettings").start_object();
crate::json_ser::serialize_structure_crate_model_email_settings(&mut object_162, var_161)?;
object_162.finish();
}
if let Some(var_163) = &input.sms_settings {
#[allow(unused_mut)]
let mut object_164 = object.key("smsSettings").start_object();
crate::json_ser::serialize_structure_crate_model_sms_settings(&mut object_164, var_163)?;
object_164.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_update_backend_auth_forgot_password_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::UpdateBackendAuthForgotPasswordConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_165) = &input.delivery_method {
object.key("deliveryMethod").string(var_165.as_str());
}
if let Some(var_166) = &input.email_settings {
#[allow(unused_mut)]
let mut object_167 = object.key("emailSettings").start_object();
crate::json_ser::serialize_structure_crate_model_email_settings(&mut object_167, var_166)?;
object_167.finish();
}
if let Some(var_168) = &input.sms_settings {
#[allow(unused_mut)]
let mut object_169 = object.key("smsSettings").start_object();
crate::json_ser::serialize_structure_crate_model_sms_settings(&mut object_169, var_168)?;
object_169.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_update_backend_auth_mfa_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::UpdateBackendAuthMfaConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_170) = &input.mfa_mode {
object.key("MFAMode").string(var_170.as_str());
}
if let Some(var_171) = &input.settings {
#[allow(unused_mut)]
let mut object_172 = object.key("settings").start_object();
crate::json_ser::serialize_structure_crate_model_settings(&mut object_172, var_171)?;
object_172.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_update_backend_auth_o_auth_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::UpdateBackendAuthOAuthConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_173) = &input.domain_prefix {
object.key("domainPrefix").string(var_173.as_str());
}
if let Some(var_174) = &input.o_auth_grant_type {
object.key("oAuthGrantType").string(var_174.as_str());
}
if let Some(var_175) = &input.o_auth_scopes {
let mut array_176 = object.key("oAuthScopes").start_array();
for item_177 in var_175 {
{
array_176.value().string(item_177.as_str());
}
}
array_176.finish();
}
if let Some(var_178) = &input.redirect_sign_in_ur_is {
let mut array_179 = object.key("redirectSignInURIs").start_array();
for item_180 in var_178 {
{
array_179.value().string(item_180.as_str());
}
}
array_179.finish();
}
if let Some(var_181) = &input.redirect_sign_out_ur_is {
let mut array_182 = object.key("redirectSignOutURIs").start_array();
for item_183 in var_181 {
{
array_182.value().string(item_183.as_str());
}
}
array_182.finish();
}
if let Some(var_184) = &input.social_provider_settings {
#[allow(unused_mut)]
let mut object_185 = object.key("socialProviderSettings").start_object();
crate::json_ser::serialize_structure_crate_model_social_provider_settings(
&mut object_185,
var_184,
)?;
object_185.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_update_backend_auth_password_policy_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::UpdateBackendAuthPasswordPolicyConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_186) = &input.additional_constraints {
let mut array_187 = object.key("additionalConstraints").start_array();
for item_188 in var_186 {
{
array_187.value().string(item_188.as_str());
}
}
array_187.finish();
}
if input.minimum_length != 0.0 {
object.key("minimumLength").number(
#[allow(clippy::useless_conversion)]
aws_smithy_types::Number::Float((input.minimum_length).into()),
);
}
Ok(())
}
pub fn serialize_structure_crate_model_update_backend_auth_verification_message_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::UpdateBackendAuthVerificationMessageConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_189) = &input.delivery_method {
object.key("deliveryMethod").string(var_189.as_str());
}
if let Some(var_190) = &input.email_settings {
#[allow(unused_mut)]
let mut object_191 = object.key("emailSettings").start_object();
crate::json_ser::serialize_structure_crate_model_email_settings(&mut object_191, var_190)?;
object_191.finish();
}
if let Some(var_192) = &input.sms_settings {
#[allow(unused_mut)]
let mut object_193 = object.key("smsSettings").start_object();
crate::json_ser::serialize_structure_crate_model_sms_settings(&mut object_193, var_192)?;
object_193.finish();
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for DeliveryMethod
impl AsRef<str> for DeliveryMethod
source§impl Clone for DeliveryMethod
impl Clone for DeliveryMethod
source§fn clone(&self) -> DeliveryMethod
fn clone(&self) -> DeliveryMethod
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for DeliveryMethod
impl Debug for DeliveryMethod
source§impl From<&str> for DeliveryMethod
impl From<&str> for DeliveryMethod
source§impl FromStr for DeliveryMethod
impl FromStr for DeliveryMethod
source§impl Hash for DeliveryMethod
impl Hash for DeliveryMethod
source§impl Ord for DeliveryMethod
impl Ord for DeliveryMethod
source§fn cmp(&self, other: &DeliveryMethod) -> Ordering
fn cmp(&self, other: &DeliveryMethod) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<DeliveryMethod> for DeliveryMethod
impl PartialEq<DeliveryMethod> for DeliveryMethod
source§fn eq(&self, other: &DeliveryMethod) -> bool
fn eq(&self, other: &DeliveryMethod) -> bool
source§impl PartialOrd<DeliveryMethod> for DeliveryMethod
impl PartialOrd<DeliveryMethod> for DeliveryMethod
source§fn partial_cmp(&self, other: &DeliveryMethod) -> Option<Ordering>
fn partial_cmp(&self, other: &DeliveryMethod) -> 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 DeliveryMethod
impl StructuralEq for DeliveryMethod
impl StructuralPartialEq for DeliveryMethod
Auto Trait Implementations§
impl RefUnwindSafe for DeliveryMethod
impl Send for DeliveryMethod
impl Sync for DeliveryMethod
impl Unpin for DeliveryMethod
impl UnwindSafe for DeliveryMethod
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.