#[non_exhaustive]
pub enum EntityRecognizerDataFormat {
AugmentedManifest,
ComprehendCsv,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against EntityRecognizerDataFormat, 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 entityrecognizerdataformat = unimplemented!();
match entityrecognizerdataformat {
EntityRecognizerDataFormat::AugmentedManifest => { /* ... */ },
EntityRecognizerDataFormat::ComprehendCsv => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when entityrecognizerdataformat represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant EntityRecognizerDataFormat::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
EntityRecognizerDataFormat::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 EntityRecognizerDataFormat::NewFeature is defined.
Specifically, when entityrecognizerdataformat represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on EntityRecognizerDataFormat::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
AugmentedManifest
ComprehendCsv
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl EntityRecognizerDataFormat
impl EntityRecognizerDataFormat
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
1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790
pub fn serialize_structure_crate_model_entity_recognizer_input_data_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::EntityRecognizerInputDataConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_344) = &input.data_format {
object.key("DataFormat").string(var_344.as_str());
}
if let Some(var_345) = &input.entity_types {
let mut array_346 = object.key("EntityTypes").start_array();
for item_347 in var_345 {
{
#[allow(unused_mut)]
let mut object_348 = array_346.value().start_object();
crate::json_ser::serialize_structure_crate_model_entity_types_list_item(
&mut object_348,
item_347,
)?;
object_348.finish();
}
}
array_346.finish();
}
if let Some(var_349) = &input.documents {
#[allow(unused_mut)]
let mut object_350 = object.key("Documents").start_object();
crate::json_ser::serialize_structure_crate_model_entity_recognizer_documents(
&mut object_350,
var_349,
)?;
object_350.finish();
}
if let Some(var_351) = &input.annotations {
#[allow(unused_mut)]
let mut object_352 = object.key("Annotations").start_object();
crate::json_ser::serialize_structure_crate_model_entity_recognizer_annotations(
&mut object_352,
var_351,
)?;
object_352.finish();
}
if let Some(var_353) = &input.entity_list {
#[allow(unused_mut)]
let mut object_354 = object.key("EntityList").start_object();
crate::json_ser::serialize_structure_crate_model_entity_recognizer_entity_list(
&mut object_354,
var_353,
)?;
object_354.finish();
}
if let Some(var_355) = &input.augmented_manifests {
let mut array_356 = object.key("AugmentedManifests").start_array();
for item_357 in var_355 {
{
#[allow(unused_mut)]
let mut object_358 = array_356.value().start_object();
crate::json_ser::serialize_structure_crate_model_augmented_manifests_list_item(
&mut object_358,
item_357,
)?;
object_358.finish();
}
}
array_356.finish();
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for EntityRecognizerDataFormat
impl AsRef<str> for EntityRecognizerDataFormat
source§impl Clone for EntityRecognizerDataFormat
impl Clone for EntityRecognizerDataFormat
source§fn clone(&self) -> EntityRecognizerDataFormat
fn clone(&self) -> EntityRecognizerDataFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for EntityRecognizerDataFormat
impl Debug for EntityRecognizerDataFormat
source§impl From<&str> for EntityRecognizerDataFormat
impl From<&str> for EntityRecognizerDataFormat
source§impl FromStr for EntityRecognizerDataFormat
impl FromStr for EntityRecognizerDataFormat
source§impl Hash for EntityRecognizerDataFormat
impl Hash for EntityRecognizerDataFormat
source§impl Ord for EntityRecognizerDataFormat
impl Ord for EntityRecognizerDataFormat
source§fn cmp(&self, other: &EntityRecognizerDataFormat) -> Ordering
fn cmp(&self, other: &EntityRecognizerDataFormat) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<EntityRecognizerDataFormat> for EntityRecognizerDataFormat
impl PartialEq<EntityRecognizerDataFormat> for EntityRecognizerDataFormat
source§fn eq(&self, other: &EntityRecognizerDataFormat) -> bool
fn eq(&self, other: &EntityRecognizerDataFormat) -> bool
source§impl PartialOrd<EntityRecognizerDataFormat> for EntityRecognizerDataFormat
impl PartialOrd<EntityRecognizerDataFormat> for EntityRecognizerDataFormat
source§fn partial_cmp(&self, other: &EntityRecognizerDataFormat) -> Option<Ordering>
fn partial_cmp(&self, other: &EntityRecognizerDataFormat) -> 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 EntityRecognizerDataFormat
impl StructuralEq for EntityRecognizerDataFormat
impl StructuralPartialEq for EntityRecognizerDataFormat
Auto Trait Implementations§
impl RefUnwindSafe for EntityRecognizerDataFormat
impl Send for EntityRecognizerDataFormat
impl Sync for EntityRecognizerDataFormat
impl Unpin for EntityRecognizerDataFormat
impl UnwindSafe for EntityRecognizerDataFormat
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.