aws_sdk_comprehend/operation/detect_syntax/
_detect_syntax_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct DetectSyntaxInput {
6    /// <p>A UTF-8 string. The maximum string size is 5 KB.</p>
7    pub text: ::std::option::Option<::std::string::String>,
8    /// <p>The language code of the input documents. You can specify any of the following languages supported by Amazon Comprehend: German ("de"), English ("en"), Spanish ("es"), French ("fr"), Italian ("it"), or Portuguese ("pt").</p>
9    pub language_code: ::std::option::Option<crate::types::SyntaxLanguageCode>,
10}
11impl DetectSyntaxInput {
12    /// <p>A UTF-8 string. The maximum string size is 5 KB.</p>
13    pub fn text(&self) -> ::std::option::Option<&str> {
14        self.text.as_deref()
15    }
16    /// <p>The language code of the input documents. You can specify any of the following languages supported by Amazon Comprehend: German ("de"), English ("en"), Spanish ("es"), French ("fr"), Italian ("it"), or Portuguese ("pt").</p>
17    pub fn language_code(&self) -> ::std::option::Option<&crate::types::SyntaxLanguageCode> {
18        self.language_code.as_ref()
19    }
20}
21impl ::std::fmt::Debug for DetectSyntaxInput {
22    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
23        let mut formatter = f.debug_struct("DetectSyntaxInput");
24        formatter.field("text", &"*** Sensitive Data Redacted ***");
25        formatter.field("language_code", &self.language_code);
26        formatter.finish()
27    }
28}
29impl DetectSyntaxInput {
30    /// Creates a new builder-style object to manufacture [`DetectSyntaxInput`](crate::operation::detect_syntax::DetectSyntaxInput).
31    pub fn builder() -> crate::operation::detect_syntax::builders::DetectSyntaxInputBuilder {
32        crate::operation::detect_syntax::builders::DetectSyntaxInputBuilder::default()
33    }
34}
35
36/// A builder for [`DetectSyntaxInput`](crate::operation::detect_syntax::DetectSyntaxInput).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
38#[non_exhaustive]
39pub struct DetectSyntaxInputBuilder {
40    pub(crate) text: ::std::option::Option<::std::string::String>,
41    pub(crate) language_code: ::std::option::Option<crate::types::SyntaxLanguageCode>,
42}
43impl DetectSyntaxInputBuilder {
44    /// <p>A UTF-8 string. The maximum string size is 5 KB.</p>
45    /// This field is required.
46    pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
47        self.text = ::std::option::Option::Some(input.into());
48        self
49    }
50    /// <p>A UTF-8 string. The maximum string size is 5 KB.</p>
51    pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
52        self.text = input;
53        self
54    }
55    /// <p>A UTF-8 string. The maximum string size is 5 KB.</p>
56    pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
57        &self.text
58    }
59    /// <p>The language code of the input documents. You can specify any of the following languages supported by Amazon Comprehend: German ("de"), English ("en"), Spanish ("es"), French ("fr"), Italian ("it"), or Portuguese ("pt").</p>
60    /// This field is required.
61    pub fn language_code(mut self, input: crate::types::SyntaxLanguageCode) -> Self {
62        self.language_code = ::std::option::Option::Some(input);
63        self
64    }
65    /// <p>The language code of the input documents. You can specify any of the following languages supported by Amazon Comprehend: German ("de"), English ("en"), Spanish ("es"), French ("fr"), Italian ("it"), or Portuguese ("pt").</p>
66    pub fn set_language_code(mut self, input: ::std::option::Option<crate::types::SyntaxLanguageCode>) -> Self {
67        self.language_code = input;
68        self
69    }
70    /// <p>The language code of the input documents. You can specify any of the following languages supported by Amazon Comprehend: German ("de"), English ("en"), Spanish ("es"), French ("fr"), Italian ("it"), or Portuguese ("pt").</p>
71    pub fn get_language_code(&self) -> &::std::option::Option<crate::types::SyntaxLanguageCode> {
72        &self.language_code
73    }
74    /// Consumes the builder and constructs a [`DetectSyntaxInput`](crate::operation::detect_syntax::DetectSyntaxInput).
75    pub fn build(
76        self,
77    ) -> ::std::result::Result<crate::operation::detect_syntax::DetectSyntaxInput, ::aws_smithy_types::error::operation::BuildError> {
78        ::std::result::Result::Ok(crate::operation::detect_syntax::DetectSyntaxInput {
79            text: self.text,
80            language_code: self.language_code,
81        })
82    }
83}
84impl ::std::fmt::Debug for DetectSyntaxInputBuilder {
85    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
86        let mut formatter = f.debug_struct("DetectSyntaxInputBuilder");
87        formatter.field("text", &"*** Sensitive Data Redacted ***");
88        formatter.field("language_code", &self.language_code);
89        formatter.finish()
90    }
91}