Skip to main content

aws_sdk_wisdom/types/
_document_text.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The text of the document.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct DocumentText {
7    /// <p>Text in the document.</p>
8    pub text: ::std::option::Option<::std::string::String>,
9    /// <p>Highlights in the document text.</p>
10    pub highlights: ::std::option::Option<::std::vec::Vec<crate::types::Highlight>>,
11}
12impl DocumentText {
13    /// <p>Text in the document.</p>
14    pub fn text(&self) -> ::std::option::Option<&str> {
15        self.text.as_deref()
16    }
17    /// <p>Highlights in the document text.</p>
18    ///
19    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.highlights.is_none()`.
20    pub fn highlights(&self) -> &[crate::types::Highlight] {
21        self.highlights.as_deref().unwrap_or_default()
22    }
23}
24impl ::std::fmt::Debug for DocumentText {
25    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
26        let mut formatter = f.debug_struct("DocumentText");
27        formatter.field("text", &"*** Sensitive Data Redacted ***");
28        formatter.field("highlights", &self.highlights);
29        formatter.finish()
30    }
31}
32impl DocumentText {
33    /// Creates a new builder-style object to manufacture [`DocumentText`](crate::types::DocumentText).
34    pub fn builder() -> crate::types::builders::DocumentTextBuilder {
35        crate::types::builders::DocumentTextBuilder::default()
36    }
37}
38
39/// A builder for [`DocumentText`](crate::types::DocumentText).
40#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
41#[non_exhaustive]
42pub struct DocumentTextBuilder {
43    pub(crate) text: ::std::option::Option<::std::string::String>,
44    pub(crate) highlights: ::std::option::Option<::std::vec::Vec<crate::types::Highlight>>,
45}
46impl DocumentTextBuilder {
47    /// <p>Text in the document.</p>
48    pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
49        self.text = ::std::option::Option::Some(input.into());
50        self
51    }
52    /// <p>Text in the document.</p>
53    pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
54        self.text = input;
55        self
56    }
57    /// <p>Text in the document.</p>
58    pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
59        &self.text
60    }
61    /// Appends an item to `highlights`.
62    ///
63    /// To override the contents of this collection use [`set_highlights`](Self::set_highlights).
64    ///
65    /// <p>Highlights in the document text.</p>
66    pub fn highlights(mut self, input: crate::types::Highlight) -> Self {
67        let mut v = self.highlights.unwrap_or_default();
68        v.push(input);
69        self.highlights = ::std::option::Option::Some(v);
70        self
71    }
72    /// <p>Highlights in the document text.</p>
73    pub fn set_highlights(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Highlight>>) -> Self {
74        self.highlights = input;
75        self
76    }
77    /// <p>Highlights in the document text.</p>
78    pub fn get_highlights(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Highlight>> {
79        &self.highlights
80    }
81    /// Consumes the builder and constructs a [`DocumentText`](crate::types::DocumentText).
82    pub fn build(self) -> crate::types::DocumentText {
83        crate::types::DocumentText {
84            text: self.text,
85            highlights: self.highlights,
86        }
87    }
88}
89impl ::std::fmt::Debug for DocumentTextBuilder {
90    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
91        let mut formatter = f.debug_struct("DocumentTextBuilder");
92        formatter.field("text", &"*** Sensitive Data Redacted ***");
93        formatter.field("highlights", &self.highlights);
94        formatter.finish()
95    }
96}