Enum aws_sdk_quicksight::model::Status
source · #[non_exhaustive]
pub enum Status {
Disabled,
Enabled,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against Status, 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 status = unimplemented!();
match status {
Status::Disabled => { /* ... */ },
Status::Enabled => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when status represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant Status::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
Status::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 Status::NewFeature is defined.
Specifically, when status represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on Status::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
Disabled
Enabled
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl Status
impl Status
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
2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076
pub fn serialize_structure_crate_model_row_level_permission_data_set(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::RowLevelPermissionDataSet,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_442) = &input.namespace {
object.key("Namespace").string(var_442.as_str());
}
if let Some(var_443) = &input.arn {
object.key("Arn").string(var_443.as_str());
}
if let Some(var_444) = &input.permission_policy {
object.key("PermissionPolicy").string(var_444.as_str());
}
if let Some(var_445) = &input.format_version {
object.key("FormatVersion").string(var_445.as_str());
}
if let Some(var_446) = &input.status {
object.key("Status").string(var_446.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_row_level_permission_tag_configuration(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::RowLevelPermissionTagConfiguration,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_447) = &input.status {
object.key("Status").string(var_447.as_str());
}
if let Some(var_448) = &input.tag_rules {
let mut array_449 = object.key("TagRules").start_array();
for item_450 in var_448 {
{
#[allow(unused_mut)]
let mut object_451 = array_449.value().start_object();
crate::json_ser::serialize_structure_crate_model_row_level_permission_tag_rule(
&mut object_451,
item_450,
)?;
object_451.finish();
}
}
array_449.finish();
}
Ok(())
}Trait Implementations§
source§impl Ord for Status
impl Ord for Status
source§impl PartialOrd<Status> for Status
impl PartialOrd<Status> for Status
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 Status
impl StructuralEq for Status
impl StructuralPartialEq for Status
Auto Trait Implementations§
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
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.