#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct DocumentText {
pub text: ::std::option::Option<::std::string::String>,
pub highlights: ::std::option::Option<::std::vec::Vec<crate::types::Highlight>>,
}
impl DocumentText {
pub fn text(&self) -> ::std::option::Option<&str> {
self.text.as_deref()
}
pub fn highlights(&self) -> ::std::option::Option<&[crate::types::Highlight]> {
self.highlights.as_deref()
}
}
impl ::std::fmt::Debug for DocumentText {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("DocumentText");
formatter.field("text", &"*** Sensitive Data Redacted ***");
formatter.field("highlights", &self.highlights);
formatter.finish()
}
}
impl DocumentText {
pub fn builder() -> crate::types::builders::DocumentTextBuilder {
crate::types::builders::DocumentTextBuilder::default()
}
}
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
pub struct DocumentTextBuilder {
pub(crate) text: ::std::option::Option<::std::string::String>,
pub(crate) highlights: ::std::option::Option<::std::vec::Vec<crate::types::Highlight>>,
}
impl DocumentTextBuilder {
pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.text = ::std::option::Option::Some(input.into());
self
}
pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.text = input;
self
}
pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
&self.text
}
pub fn highlights(mut self, input: crate::types::Highlight) -> Self {
let mut v = self.highlights.unwrap_or_default();
v.push(input);
self.highlights = ::std::option::Option::Some(v);
self
}
pub fn set_highlights(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Highlight>>) -> Self {
self.highlights = input;
self
}
pub fn get_highlights(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Highlight>> {
&self.highlights
}
pub fn build(self) -> crate::types::DocumentText {
crate::types::DocumentText {
text: self.text,
highlights: self.highlights,
}
}
}
impl ::std::fmt::Debug for DocumentTextBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("DocumentTextBuilder");
formatter.field("text", &"*** Sensitive Data Redacted ***");
formatter.field("highlights", &self.highlights);
formatter.finish()
}
}