#[non_exhaustive]
pub enum AuthResources {
IdentityPoolAndUserPool,
UserPoolOnly,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against AuthResources, 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 authresources = unimplemented!();
match authresources {
AuthResources::IdentityPoolAndUserPool => { /* ... */ },
AuthResources::UserPoolOnly => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when authresources represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant AuthResources::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
AuthResources::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 AuthResources::NewFeature is defined.
Specifically, when authresources represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on AuthResources::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
IdentityPoolAndUserPool
UserPoolOnly
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl AuthResources
impl AuthResources
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
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
pub fn serialize_structure_crate_model_create_backend_auth_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendAuthResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_70) = &input.auth_resources {
object.key("authResources").string(var_70.as_str());
}
if let Some(var_71) = &input.identity_pool_configs {
#[allow(unused_mut)]
let mut object_72 = object.key("identityPoolConfigs").start_object();
crate::json_ser::serialize_structure_crate_model_create_backend_auth_identity_pool_config(
&mut object_72,
var_71,
)?;
object_72.finish();
}
if let Some(var_73) = &input.service {
object.key("service").string(var_73.as_str());
}
if let Some(var_74) = &input.user_pool_configs {
#[allow(unused_mut)]
let mut object_75 = object.key("userPoolConfigs").start_object();
crate::json_ser::serialize_structure_crate_model_create_backend_auth_user_pool_config(
&mut object_75,
var_74,
)?;
object_75.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_create_backend_storage_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::CreateBackendStorageResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_76) = &input.bucket_name {
object.key("bucketName").string(var_76.as_str());
}
if let Some(var_77) = &input.permissions {
#[allow(unused_mut)]
let mut object_78 = object.key("permissions").start_object();
crate::json_ser::serialize_structure_crate_model_backend_storage_permissions(
&mut object_78,
var_77,
)?;
object_78.finish();
}
if let Some(var_79) = &input.service_name {
object.key("serviceName").string(var_79.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_update_backend_auth_resource_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::UpdateBackendAuthResourceConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_80) = &input.auth_resources {
object.key("authResources").string(var_80.as_str());
}
if let Some(var_81) = &input.identity_pool_configs {
#[allow(unused_mut)]
let mut object_82 = object.key("identityPoolConfigs").start_object();
crate::json_ser::serialize_structure_crate_model_update_backend_auth_identity_pool_config(
&mut object_82,
var_81,
)?;
object_82.finish();
}
if let Some(var_83) = &input.service {
object.key("service").string(var_83.as_str());
}
if let Some(var_84) = &input.user_pool_configs {
#[allow(unused_mut)]
let mut object_85 = object.key("userPoolConfigs").start_object();
crate::json_ser::serialize_structure_crate_model_update_backend_auth_user_pool_config(
&mut object_85,
var_84,
)?;
object_85.finish();
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for AuthResources
impl AsRef<str> for AuthResources
source§impl Clone for AuthResources
impl Clone for AuthResources
source§fn clone(&self) -> AuthResources
fn clone(&self) -> AuthResources
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for AuthResources
impl Debug for AuthResources
source§impl From<&str> for AuthResources
impl From<&str> for AuthResources
source§impl FromStr for AuthResources
impl FromStr for AuthResources
source§impl Hash for AuthResources
impl Hash for AuthResources
source§impl Ord for AuthResources
impl Ord for AuthResources
source§fn cmp(&self, other: &AuthResources) -> Ordering
fn cmp(&self, other: &AuthResources) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<AuthResources> for AuthResources
impl PartialEq<AuthResources> for AuthResources
source§fn eq(&self, other: &AuthResources) -> bool
fn eq(&self, other: &AuthResources) -> bool
source§impl PartialOrd<AuthResources> for AuthResources
impl PartialOrd<AuthResources> for AuthResources
source§fn partial_cmp(&self, other: &AuthResources) -> Option<Ordering>
fn partial_cmp(&self, other: &AuthResources) -> 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 AuthResources
impl StructuralEq for AuthResources
impl StructuralPartialEq for AuthResources
Auto Trait Implementations§
impl RefUnwindSafe for AuthResources
impl Send for AuthResources
impl Sync for AuthResources
impl Unpin for AuthResources
impl UnwindSafe for AuthResources
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.