Enum aws_sdk_cloudsearch::model::IndexFieldType
source · #[non_exhaustive]
pub enum IndexFieldType {
Date,
DateArray,
Double,
DoubleArray,
Int,
IntArray,
Latlon,
Literal,
LiteralArray,
Text,
TextArray,
Unknown(UnknownVariantValue),
}Expand description
When writing a match expression against IndexFieldType, 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 indexfieldtype = unimplemented!();
match indexfieldtype {
IndexFieldType::Date => { /* ... */ },
IndexFieldType::DateArray => { /* ... */ },
IndexFieldType::Double => { /* ... */ },
IndexFieldType::DoubleArray => { /* ... */ },
IndexFieldType::Int => { /* ... */ },
IndexFieldType::IntArray => { /* ... */ },
IndexFieldType::Latlon => { /* ... */ },
IndexFieldType::Literal => { /* ... */ },
IndexFieldType::LiteralArray => { /* ... */ },
IndexFieldType::Text => { /* ... */ },
IndexFieldType::TextArray => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when indexfieldtype represents
NewFeature, the execution path will lead to the second last match arm,
even though the enum does not contain a variant IndexFieldType::NewFeature
in the current version of SDK. The reason is that the variable other,
created by the @ operator, is bound to
IndexFieldType::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 IndexFieldType::NewFeature is defined.
Specifically, when indexfieldtype represents NewFeature,
the execution path will hit the second last match arm as before by virtue of
calling as_str on IndexFieldType::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.
The type of field. The valid options for a field depend on the field type. For more information about the supported field types, see Configuring Index Fields in the Amazon CloudSearch Developer Guide.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Date
DateArray
Double
DoubleArray
Int
IntArray
Latlon
Literal
LiteralArray
Text
TextArray
Unknown(UnknownVariantValue)
Unknown contains new variants that have been added since this code was generated.
Implementations§
source§impl IndexFieldType
impl IndexFieldType
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
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
pub fn serialize_structure_crate_model_index_field(
mut writer: aws_smithy_query::QueryValueWriter,
input: &crate::model::IndexField,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
#[allow(unused_mut)]
let mut scope_11 = writer.prefix("IndexFieldName");
if let Some(var_12) = &input.index_field_name {
scope_11.string(var_12);
}
#[allow(unused_mut)]
let mut scope_13 = writer.prefix("IndexFieldType");
if let Some(var_14) = &input.index_field_type {
scope_13.string(var_14.as_str());
}
#[allow(unused_mut)]
let mut scope_15 = writer.prefix("IntOptions");
if let Some(var_16) = &input.int_options {
crate::query_ser::serialize_structure_crate_model_int_options(scope_15, var_16)?;
}
#[allow(unused_mut)]
let mut scope_17 = writer.prefix("DoubleOptions");
if let Some(var_18) = &input.double_options {
crate::query_ser::serialize_structure_crate_model_double_options(scope_17, var_18)?;
}
#[allow(unused_mut)]
let mut scope_19 = writer.prefix("LiteralOptions");
if let Some(var_20) = &input.literal_options {
crate::query_ser::serialize_structure_crate_model_literal_options(scope_19, var_20)?;
}
#[allow(unused_mut)]
let mut scope_21 = writer.prefix("TextOptions");
if let Some(var_22) = &input.text_options {
crate::query_ser::serialize_structure_crate_model_text_options(scope_21, var_22)?;
}
#[allow(unused_mut)]
let mut scope_23 = writer.prefix("DateOptions");
if let Some(var_24) = &input.date_options {
crate::query_ser::serialize_structure_crate_model_date_options(scope_23, var_24)?;
}
#[allow(unused_mut)]
let mut scope_25 = writer.prefix("LatLonOptions");
if let Some(var_26) = &input.lat_lon_options {
crate::query_ser::serialize_structure_crate_model_lat_lon_options(scope_25, var_26)?;
}
#[allow(unused_mut)]
let mut scope_27 = writer.prefix("IntArrayOptions");
if let Some(var_28) = &input.int_array_options {
crate::query_ser::serialize_structure_crate_model_int_array_options(scope_27, var_28)?;
}
#[allow(unused_mut)]
let mut scope_29 = writer.prefix("DoubleArrayOptions");
if let Some(var_30) = &input.double_array_options {
crate::query_ser::serialize_structure_crate_model_double_array_options(scope_29, var_30)?;
}
#[allow(unused_mut)]
let mut scope_31 = writer.prefix("LiteralArrayOptions");
if let Some(var_32) = &input.literal_array_options {
crate::query_ser::serialize_structure_crate_model_literal_array_options(scope_31, var_32)?;
}
#[allow(unused_mut)]
let mut scope_33 = writer.prefix("TextArrayOptions");
if let Some(var_34) = &input.text_array_options {
crate::query_ser::serialize_structure_crate_model_text_array_options(scope_33, var_34)?;
}
#[allow(unused_mut)]
let mut scope_35 = writer.prefix("DateArrayOptions");
if let Some(var_36) = &input.date_array_options {
crate::query_ser::serialize_structure_crate_model_date_array_options(scope_35, var_36)?;
}
Ok(())
}Trait Implementations§
source§impl AsRef<str> for IndexFieldType
impl AsRef<str> for IndexFieldType
source§impl Clone for IndexFieldType
impl Clone for IndexFieldType
source§fn clone(&self) -> IndexFieldType
fn clone(&self) -> IndexFieldType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for IndexFieldType
impl Debug for IndexFieldType
source§impl From<&str> for IndexFieldType
impl From<&str> for IndexFieldType
source§impl FromStr for IndexFieldType
impl FromStr for IndexFieldType
source§impl Hash for IndexFieldType
impl Hash for IndexFieldType
source§impl Ord for IndexFieldType
impl Ord for IndexFieldType
source§fn cmp(&self, other: &IndexFieldType) -> Ordering
fn cmp(&self, other: &IndexFieldType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<IndexFieldType> for IndexFieldType
impl PartialEq<IndexFieldType> for IndexFieldType
source§fn eq(&self, other: &IndexFieldType) -> bool
fn eq(&self, other: &IndexFieldType) -> bool
source§impl PartialOrd<IndexFieldType> for IndexFieldType
impl PartialOrd<IndexFieldType> for IndexFieldType
source§fn partial_cmp(&self, other: &IndexFieldType) -> Option<Ordering>
fn partial_cmp(&self, other: &IndexFieldType) -> 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 IndexFieldType
impl StructuralEq for IndexFieldType
impl StructuralPartialEq for IndexFieldType
Auto Trait Implementations§
impl RefUnwindSafe for IndexFieldType
impl Send for IndexFieldType
impl Sync for IndexFieldType
impl Unpin for IndexFieldType
impl UnwindSafe for IndexFieldType
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.