1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Provides information that you can use to highlight a search result so that your users can quickly identify terms in the response.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Highlight {
/// <p>The zero-based location in the response string where the highlight starts.</p>
pub begin_offset: i32,
/// <p>The zero-based location in the response string where the highlight ends.</p>
pub end_offset: i32,
/// <p>Indicates whether the response is the best response. True if this is the best response; otherwise, false.</p>
pub top_answer: bool,
/// <p>The highlight type.</p>
pub r#type: ::std::option::Option<crate::types::HighlightType>,
}
impl Highlight {
/// <p>The zero-based location in the response string where the highlight starts.</p>
pub fn begin_offset(&self) -> i32 {
self.begin_offset
}
/// <p>The zero-based location in the response string where the highlight ends.</p>
pub fn end_offset(&self) -> i32 {
self.end_offset
}
/// <p>Indicates whether the response is the best response. True if this is the best response; otherwise, false.</p>
pub fn top_answer(&self) -> bool {
self.top_answer
}
/// <p>The highlight type.</p>
pub fn r#type(&self) -> ::std::option::Option<&crate::types::HighlightType> {
self.r#type.as_ref()
}
}
impl Highlight {
/// Creates a new builder-style object to manufacture [`Highlight`](crate::types::Highlight).
pub fn builder() -> crate::types::builders::HighlightBuilder {
crate::types::builders::HighlightBuilder::default()
}
}
/// A builder for [`Highlight`](crate::types::Highlight).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct HighlightBuilder {
pub(crate) begin_offset: ::std::option::Option<i32>,
pub(crate) end_offset: ::std::option::Option<i32>,
pub(crate) top_answer: ::std::option::Option<bool>,
pub(crate) r#type: ::std::option::Option<crate::types::HighlightType>,
}
impl HighlightBuilder {
/// <p>The zero-based location in the response string where the highlight starts.</p>
/// This field is required.
pub fn begin_offset(mut self, input: i32) -> Self {
self.begin_offset = ::std::option::Option::Some(input);
self
}
/// <p>The zero-based location in the response string where the highlight starts.</p>
pub fn set_begin_offset(mut self, input: ::std::option::Option<i32>) -> Self {
self.begin_offset = input;
self
}
/// <p>The zero-based location in the response string where the highlight starts.</p>
pub fn get_begin_offset(&self) -> &::std::option::Option<i32> {
&self.begin_offset
}
/// <p>The zero-based location in the response string where the highlight ends.</p>
/// This field is required.
pub fn end_offset(mut self, input: i32) -> Self {
self.end_offset = ::std::option::Option::Some(input);
self
}
/// <p>The zero-based location in the response string where the highlight ends.</p>
pub fn set_end_offset(mut self, input: ::std::option::Option<i32>) -> Self {
self.end_offset = input;
self
}
/// <p>The zero-based location in the response string where the highlight ends.</p>
pub fn get_end_offset(&self) -> &::std::option::Option<i32> {
&self.end_offset
}
/// <p>Indicates whether the response is the best response. True if this is the best response; otherwise, false.</p>
pub fn top_answer(mut self, input: bool) -> Self {
self.top_answer = ::std::option::Option::Some(input);
self
}
/// <p>Indicates whether the response is the best response. True if this is the best response; otherwise, false.</p>
pub fn set_top_answer(mut self, input: ::std::option::Option<bool>) -> Self {
self.top_answer = input;
self
}
/// <p>Indicates whether the response is the best response. True if this is the best response; otherwise, false.</p>
pub fn get_top_answer(&self) -> &::std::option::Option<bool> {
&self.top_answer
}
/// <p>The highlight type.</p>
pub fn r#type(mut self, input: crate::types::HighlightType) -> Self {
self.r#type = ::std::option::Option::Some(input);
self
}
/// <p>The highlight type.</p>
pub fn set_type(mut self, input: ::std::option::Option<crate::types::HighlightType>) -> Self {
self.r#type = input;
self
}
/// <p>The highlight type.</p>
pub fn get_type(&self) -> &::std::option::Option<crate::types::HighlightType> {
&self.r#type
}
/// Consumes the builder and constructs a [`Highlight`](crate::types::Highlight).
/// This method will fail if any of the following fields are not set:
/// - [`begin_offset`](crate::types::builders::HighlightBuilder::begin_offset)
/// - [`end_offset`](crate::types::builders::HighlightBuilder::end_offset)
pub fn build(self) -> ::std::result::Result<crate::types::Highlight, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Highlight {
begin_offset: self.begin_offset.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"begin_offset",
"begin_offset was not specified but it is required when building Highlight",
)
})?,
end_offset: self.end_offset.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"end_offset",
"end_offset was not specified but it is required when building Highlight",
)
})?,
top_answer: self.top_answer.unwrap_or_default(),
r#type: self.r#type,
})
}
}