aws-sdk-cloudsearch 1.98.0

AWS SDK for Amazon CloudSearch
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(unused_mut)]
pub fn ser_analysis_options(
    mut writer: ::aws_smithy_query::QueryValueWriter,
    input: &crate::types::AnalysisOptions,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope_1 = writer.prefix("Synonyms");
    if let Some(var_2) = &input.synonyms {
        scope_1.string(var_2);
    }
    #[allow(unused_mut)]
    let mut scope_3 = writer.prefix("Stopwords");
    if let Some(var_4) = &input.stopwords {
        scope_3.string(var_4);
    }
    #[allow(unused_mut)]
    let mut scope_5 = writer.prefix("StemmingDictionary");
    if let Some(var_6) = &input.stemming_dictionary {
        scope_5.string(var_6);
    }
    #[allow(unused_mut)]
    let mut scope_7 = writer.prefix("JapaneseTokenizationDictionary");
    if let Some(var_8) = &input.japanese_tokenization_dictionary {
        scope_7.string(var_8);
    }
    #[allow(unused_mut)]
    let mut scope_9 = writer.prefix("AlgorithmicStemming");
    if let Some(var_10) = &input.algorithmic_stemming {
        scope_9.string(var_10.as_str());
    }
    Ok(())
}

#[allow(clippy::needless_question_mark)]
pub fn de_analysis_options(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::AnalysisOptions, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::AnalysisOptions::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("Synonyms") /* Synonyms com.amazonaws.cloudsearch#AnalysisOptions$Synonyms */ =>  {
                let var_11 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_synonyms(var_11);
            }
            ,
            s if s.matches("Stopwords") /* Stopwords com.amazonaws.cloudsearch#AnalysisOptions$Stopwords */ =>  {
                let var_12 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_stopwords(var_12);
            }
            ,
            s if s.matches("StemmingDictionary") /* StemmingDictionary com.amazonaws.cloudsearch#AnalysisOptions$StemmingDictionary */ =>  {
                let var_13 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_stemming_dictionary(var_13);
            }
            ,
            s if s.matches("JapaneseTokenizationDictionary") /* JapaneseTokenizationDictionary com.amazonaws.cloudsearch#AnalysisOptions$JapaneseTokenizationDictionary */ =>  {
                let var_14 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_japanese_tokenization_dictionary(var_14);
            }
            ,
            s if s.matches("AlgorithmicStemming") /* AlgorithmicStemming com.amazonaws.cloudsearch#AnalysisOptions$AlgorithmicStemming */ =>  {
                let var_15 =
                    Some(
                        Result::<crate::types::AlgorithmicStemming, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::AlgorithmicStemming::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_algorithmic_stemming(var_15);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}