Enum aws_sdk_personalize::model::IngestionMode
source · #[non_exhaustive]
pub enum IngestionMode {
All,
Bulk,
Put,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against IngestionMode
, 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 ingestionmode = unimplemented!();
match ingestionmode {
IngestionMode::All => { /* ... */ },
IngestionMode::Bulk => { /* ... */ },
IngestionMode::Put => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when ingestionmode
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant IngestionMode::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
IngestionMode::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 IngestionMode::NewFeature
is defined.
Specifically, when ingestionmode
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on IngestionMode::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
All
Bulk
Put
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
source§impl IngestionMode
impl IngestionMode
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
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
pub fn serialize_structure_crate_input_create_dataset_export_job_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::CreateDatasetExportJobInput,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_46) = &input.job_name {
object.key("jobName").string(var_46.as_str());
}
if let Some(var_47) = &input.dataset_arn {
object.key("datasetArn").string(var_47.as_str());
}
if let Some(var_48) = &input.ingestion_mode {
object.key("ingestionMode").string(var_48.as_str());
}
if let Some(var_49) = &input.role_arn {
object.key("roleArn").string(var_49.as_str());
}
if let Some(var_50) = &input.job_output {
#[allow(unused_mut)]
let mut object_51 = object.key("jobOutput").start_object();
crate::json_ser::serialize_structure_crate_model_dataset_export_job_output(
&mut object_51,
var_50,
)?;
object_51.finish();
}
if let Some(var_52) = &input.tags {
let mut array_53 = object.key("tags").start_array();
for item_54 in var_52 {
{
#[allow(unused_mut)]
let mut object_55 = array_53.value().start_object();
crate::json_ser::serialize_structure_crate_model_tag(&mut object_55, item_54)?;
object_55.finish();
}
}
array_53.finish();
}
Ok(())
}
Trait Implementations§
source§impl AsRef<str> for IngestionMode
impl AsRef<str> for IngestionMode
source§impl Clone for IngestionMode
impl Clone for IngestionMode
source§fn clone(&self) -> IngestionMode
fn clone(&self) -> IngestionMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for IngestionMode
impl Debug for IngestionMode
source§impl From<&str> for IngestionMode
impl From<&str> for IngestionMode
source§impl FromStr for IngestionMode
impl FromStr for IngestionMode
source§impl Hash for IngestionMode
impl Hash for IngestionMode
source§impl Ord for IngestionMode
impl Ord for IngestionMode
source§fn cmp(&self, other: &IngestionMode) -> Ordering
fn cmp(&self, other: &IngestionMode) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<IngestionMode> for IngestionMode
impl PartialEq<IngestionMode> for IngestionMode
source§fn eq(&self, other: &IngestionMode) -> bool
fn eq(&self, other: &IngestionMode) -> bool
source§impl PartialOrd<IngestionMode> for IngestionMode
impl PartialOrd<IngestionMode> for IngestionMode
source§fn partial_cmp(&self, other: &IngestionMode) -> Option<Ordering>
fn partial_cmp(&self, other: &IngestionMode) -> 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 IngestionMode
impl StructuralEq for IngestionMode
impl StructuralPartialEq for IngestionMode
Auto Trait Implementations§
impl RefUnwindSafe for IngestionMode
impl Send for IngestionMode
impl Sync for IngestionMode
impl Unpin for IngestionMode
impl UnwindSafe for IngestionMode
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.