Enum aws_sdk_s3control::model::JobReportFormat
source · #[non_exhaustive]
pub enum JobReportFormat {
ReportCsv20180820,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against JobReportFormat
, 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 jobreportformat = unimplemented!();
match jobreportformat {
JobReportFormat::ReportCsv20180820 => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when jobreportformat
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant JobReportFormat::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
JobReportFormat::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 JobReportFormat::NewFeature
is defined.
Specifically, when jobreportformat
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on JobReportFormat::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
ReportCsv20180820
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl JobReportFormat
impl JobReportFormat
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
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
pub fn serialize_structure_crate_model_job_report(
input: &crate::model::JobReport,
writer: aws_smithy_xml::encode::ElWriter,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope = writer.finish();
if let Some(var_51) = &input.bucket {
let mut inner_writer = scope.start_el("Bucket").finish();
inner_writer.data(var_51.as_str());
}
if let Some(var_52) = &input.format {
let mut inner_writer = scope.start_el("Format").finish();
inner_writer.data(var_52.as_str());
}
{
let mut inner_writer = scope.start_el("Enabled").finish();
inner_writer.data(aws_smithy_types::primitive::Encoder::from(input.enabled).encode());
}
if let Some(var_53) = &input.prefix {
let mut inner_writer = scope.start_el("Prefix").finish();
inner_writer.data(var_53.as_str());
}
if let Some(var_54) = &input.report_scope {
let mut inner_writer = scope.start_el("ReportScope").finish();
inner_writer.data(var_54.as_str());
}
scope.finish();
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for JobReportFormat
impl AsRef<str> for JobReportFormat
source§impl Clone for JobReportFormat
impl Clone for JobReportFormat
source§fn clone(&self) -> JobReportFormat
fn clone(&self) -> JobReportFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for JobReportFormat
impl Debug for JobReportFormat
source§impl From<&str> for JobReportFormat
impl From<&str> for JobReportFormat
source§impl FromStr for JobReportFormat
impl FromStr for JobReportFormat
source§impl Hash for JobReportFormat
impl Hash for JobReportFormat
source§impl Ord for JobReportFormat
impl Ord for JobReportFormat
source§fn cmp(&self, other: &JobReportFormat) -> Ordering
fn cmp(&self, other: &JobReportFormat) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<JobReportFormat> for JobReportFormat
impl PartialEq<JobReportFormat> for JobReportFormat
source§fn eq(&self, other: &JobReportFormat) -> bool
fn eq(&self, other: &JobReportFormat) -> bool
source§impl PartialOrd<JobReportFormat> for JobReportFormat
impl PartialOrd<JobReportFormat> for JobReportFormat
source§fn partial_cmp(&self, other: &JobReportFormat) -> Option<Ordering>
fn partial_cmp(&self, other: &JobReportFormat) -> 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 JobReportFormat
impl StructuralEq for JobReportFormat
impl StructuralPartialEq for JobReportFormat
Auto Trait Implementations§
impl RefUnwindSafe for JobReportFormat
impl Send for JobReportFormat
impl Sync for JobReportFormat
impl Unpin for JobReportFormat
impl UnwindSafe for JobReportFormat
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.