Enum aws_sdk_comprehend::model::InputFormat
source · #[non_exhaustive]
pub enum InputFormat {
OneDocPerFile,
OneDocPerLine,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against InputFormat, 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 inputformat = unimplemented!();
match inputformat {
InputFormat::OneDocPerFile => { /* ... */ },
InputFormat::OneDocPerLine => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when inputformat represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant InputFormat::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
InputFormat::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 InputFormat::NewFeature is defined.
Specifically, when inputformat represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on InputFormat::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
OneDocPerFile
OneDocPerLine
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl InputFormat
impl InputFormat
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
2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182
pub fn serialize_structure_crate_model_input_data_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::InputDataConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_407) = &input.s3_uri {
object.key("S3Uri").string(var_407.as_str());
}
if let Some(var_408) = &input.input_format {
object.key("InputFormat").string(var_408.as_str());
}
if let Some(var_409) = &input.document_reader_config {
#[allow(unused_mut)]
let mut object_410 = object.key("DocumentReaderConfig").start_object();
crate::json_ser::serialize_structure_crate_model_document_reader_config(
&mut object_410,
var_409,
)?;
object_410.finish();
}
Ok(())
}
pub fn serialize_structure_crate_model_output_data_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::OutputDataConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_411) = &input.s3_uri {
object.key("S3Uri").string(var_411.as_str());
}
if let Some(var_412) = &input.kms_key_id {
object.key("KmsKeyId").string(var_412.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_redaction_config(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::RedactionConfig,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_413) = &input.pii_entity_types {
let mut array_414 = object.key("PiiEntityTypes").start_array();
for item_415 in var_413 {
{
array_414.value().string(item_415.as_str());
}
}
array_414.finish();
}
if let Some(var_416) = &input.mask_mode {
object.key("MaskMode").string(var_416.as_str());
}
if let Some(var_417) = &input.mask_character {
object.key("MaskCharacter").string(var_417.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_augmented_manifests_list_item(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::AugmentedManifestsListItem,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_418) = &input.s3_uri {
object.key("S3Uri").string(var_418.as_str());
}
if let Some(var_419) = &input.split {
object.key("Split").string(var_419.as_str());
}
if let Some(var_420) = &input.attribute_names {
let mut array_421 = object.key("AttributeNames").start_array();
for item_422 in var_420 {
{
array_421.value().string(item_422.as_str());
}
}
array_421.finish();
}
if let Some(var_423) = &input.annotation_data_s3_uri {
object.key("AnnotationDataS3Uri").string(var_423.as_str());
}
if let Some(var_424) = &input.source_documents_s3_uri {
object.key("SourceDocumentsS3Uri").string(var_424.as_str());
}
if let Some(var_425) = &input.document_type {
object.key("DocumentType").string(var_425.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_entity_types_list_item(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::EntityTypesListItem,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_426) = &input.r#type {
object.key("Type").string(var_426.as_str());
}
Ok(())
}
pub fn serialize_structure_crate_model_entity_recognizer_documents(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::model::EntityRecognizerDocuments,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_427) = &input.s3_uri {
object.key("S3Uri").string(var_427.as_str());
}
if let Some(var_428) = &input.test_s3_uri {
object.key("TestS3Uri").string(var_428.as_str());
}
if let Some(var_429) = &input.input_format {
object.key("InputFormat").string(var_429.as_str());
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for InputFormat
impl AsRef<str> for InputFormat
source§impl Clone for InputFormat
impl Clone for InputFormat
source§fn clone(&self) -> InputFormat
fn clone(&self) -> InputFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for InputFormat
impl Debug for InputFormat
source§impl From<&str> for InputFormat
impl From<&str> for InputFormat
source§impl FromStr for InputFormat
impl FromStr for InputFormat
source§impl Hash for InputFormat
impl Hash for InputFormat
source§impl Ord for InputFormat
impl Ord for InputFormat
source§fn cmp(&self, other: &InputFormat) -> Ordering
fn cmp(&self, other: &InputFormat) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<InputFormat> for InputFormat
impl PartialEq<InputFormat> for InputFormat
source§fn eq(&self, other: &InputFormat) -> bool
fn eq(&self, other: &InputFormat) -> bool
source§impl PartialOrd<InputFormat> for InputFormat
impl PartialOrd<InputFormat> for InputFormat
source§fn partial_cmp(&self, other: &InputFormat) -> Option<Ordering>
fn partial_cmp(&self, other: &InputFormat) -> 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 InputFormat
impl StructuralEq for InputFormat
impl StructuralPartialEq for InputFormat
Auto Trait Implementations§
impl RefUnwindSafe for InputFormat
impl Send for InputFormat
impl Sync for InputFormat
impl Unpin for InputFormat
impl UnwindSafe for InputFormat
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.