aws_sdk_wisdom/types/
_document_text.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct DocumentText {
7 pub text: ::std::option::Option<::std::string::String>,
9 pub highlights: ::std::option::Option<::std::vec::Vec<crate::types::Highlight>>,
11}
12impl DocumentText {
13 pub fn text(&self) -> ::std::option::Option<&str> {
15 self.text.as_deref()
16 }
17 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 pub fn builder() -> crate::types::builders::DocumentTextBuilder {
35 crate::types::builders::DocumentTextBuilder::default()
36 }
37}
38
39#[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 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 pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
54 self.text = input;
55 self
56 }
57 pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
59 &self.text
60 }
61 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 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 pub fn get_highlights(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Highlight>> {
79 &self.highlights
80 }
81 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}