aws_sdk_comprehend/operation/detect_syntax/
_detect_syntax_output.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 DetectSyntaxOutput {
6    /// <p>A collection of syntax tokens describing the text. For each token, the response provides the text, the token type, where the text begins and ends, and the level of confidence that Amazon Comprehend has that the token is correct. For a list of token types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-syntax.html">Syntax</a> in the Comprehend Developer Guide.</p>
7    pub syntax_tokens: ::std::option::Option<::std::vec::Vec<crate::types::SyntaxToken>>,
8    _request_id: Option<String>,
9}
10impl DetectSyntaxOutput {
11    /// <p>A collection of syntax tokens describing the text. For each token, the response provides the text, the token type, where the text begins and ends, and the level of confidence that Amazon Comprehend has that the token is correct. For a list of token types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-syntax.html">Syntax</a> in the Comprehend Developer Guide.</p>
12    ///
13    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.syntax_tokens.is_none()`.
14    pub fn syntax_tokens(&self) -> &[crate::types::SyntaxToken] {
15        self.syntax_tokens.as_deref().unwrap_or_default()
16    }
17}
18impl ::std::fmt::Debug for DetectSyntaxOutput {
19    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
20        let mut formatter = f.debug_struct("DetectSyntaxOutput");
21        formatter.field("syntax_tokens", &"*** Sensitive Data Redacted ***");
22        formatter.field("_request_id", &self._request_id);
23        formatter.finish()
24    }
25}
26impl ::aws_types::request_id::RequestId for DetectSyntaxOutput {
27    fn request_id(&self) -> Option<&str> {
28        self._request_id.as_deref()
29    }
30}
31impl DetectSyntaxOutput {
32    /// Creates a new builder-style object to manufacture [`DetectSyntaxOutput`](crate::operation::detect_syntax::DetectSyntaxOutput).
33    pub fn builder() -> crate::operation::detect_syntax::builders::DetectSyntaxOutputBuilder {
34        crate::operation::detect_syntax::builders::DetectSyntaxOutputBuilder::default()
35    }
36}
37
38/// A builder for [`DetectSyntaxOutput`](crate::operation::detect_syntax::DetectSyntaxOutput).
39#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
40#[non_exhaustive]
41pub struct DetectSyntaxOutputBuilder {
42    pub(crate) syntax_tokens: ::std::option::Option<::std::vec::Vec<crate::types::SyntaxToken>>,
43    _request_id: Option<String>,
44}
45impl DetectSyntaxOutputBuilder {
46    /// Appends an item to `syntax_tokens`.
47    ///
48    /// To override the contents of this collection use [`set_syntax_tokens`](Self::set_syntax_tokens).
49    ///
50    /// <p>A collection of syntax tokens describing the text. For each token, the response provides the text, the token type, where the text begins and ends, and the level of confidence that Amazon Comprehend has that the token is correct. For a list of token types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-syntax.html">Syntax</a> in the Comprehend Developer Guide.</p>
51    pub fn syntax_tokens(mut self, input: crate::types::SyntaxToken) -> Self {
52        let mut v = self.syntax_tokens.unwrap_or_default();
53        v.push(input);
54        self.syntax_tokens = ::std::option::Option::Some(v);
55        self
56    }
57    /// <p>A collection of syntax tokens describing the text. For each token, the response provides the text, the token type, where the text begins and ends, and the level of confidence that Amazon Comprehend has that the token is correct. For a list of token types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-syntax.html">Syntax</a> in the Comprehend Developer Guide.</p>
58    pub fn set_syntax_tokens(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SyntaxToken>>) -> Self {
59        self.syntax_tokens = input;
60        self
61    }
62    /// <p>A collection of syntax tokens describing the text. For each token, the response provides the text, the token type, where the text begins and ends, and the level of confidence that Amazon Comprehend has that the token is correct. For a list of token types, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/how-syntax.html">Syntax</a> in the Comprehend Developer Guide.</p>
63    pub fn get_syntax_tokens(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SyntaxToken>> {
64        &self.syntax_tokens
65    }
66    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
67        self._request_id = Some(request_id.into());
68        self
69    }
70
71    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
72        self._request_id = request_id;
73        self
74    }
75    /// Consumes the builder and constructs a [`DetectSyntaxOutput`](crate::operation::detect_syntax::DetectSyntaxOutput).
76    pub fn build(self) -> crate::operation::detect_syntax::DetectSyntaxOutput {
77        crate::operation::detect_syntax::DetectSyntaxOutput {
78            syntax_tokens: self.syntax_tokens,
79            _request_id: self._request_id,
80        }
81    }
82}
83impl ::std::fmt::Debug for DetectSyntaxOutputBuilder {
84    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
85        let mut formatter = f.debug_struct("DetectSyntaxOutputBuilder");
86        formatter.field("syntax_tokens", &"*** Sensitive Data Redacted ***");
87        formatter.field("_request_id", &self._request_id);
88        formatter.finish()
89    }
90}