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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A reference to a substring of a literal string in a JSON document.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Substring {
/// <p>The start index of the substring, starting from 0.</p>
pub start: i32,
/// <p>The length of the substring.</p>
pub length: i32,
}
impl Substring {
/// <p>The start index of the substring, starting from 0.</p>
pub fn start(&self) -> i32 {
self.start
}
/// <p>The length of the substring.</p>
pub fn length(&self) -> i32 {
self.length
}
}
impl Substring {
/// Creates a new builder-style object to manufacture [`Substring`](crate::types::Substring).
pub fn builder() -> crate::types::builders::SubstringBuilder {
crate::types::builders::SubstringBuilder::default()
}
}
/// A builder for [`Substring`](crate::types::Substring).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SubstringBuilder {
pub(crate) start: ::std::option::Option<i32>,
pub(crate) length: ::std::option::Option<i32>,
}
impl SubstringBuilder {
/// <p>The start index of the substring, starting from 0.</p>
/// This field is required.
pub fn start(mut self, input: i32) -> Self {
self.start = ::std::option::Option::Some(input);
self
}
/// <p>The start index of the substring, starting from 0.</p>
pub fn set_start(mut self, input: ::std::option::Option<i32>) -> Self {
self.start = input;
self
}
/// <p>The start index of the substring, starting from 0.</p>
pub fn get_start(&self) -> &::std::option::Option<i32> {
&self.start
}
/// <p>The length of the substring.</p>
/// This field is required.
pub fn length(mut self, input: i32) -> Self {
self.length = ::std::option::Option::Some(input);
self
}
/// <p>The length of the substring.</p>
pub fn set_length(mut self, input: ::std::option::Option<i32>) -> Self {
self.length = input;
self
}
/// <p>The length of the substring.</p>
pub fn get_length(&self) -> &::std::option::Option<i32> {
&self.length
}
/// Consumes the builder and constructs a [`Substring`](crate::types::Substring).
/// This method will fail if any of the following fields are not set:
/// - [`start`](crate::types::builders::SubstringBuilder::start)
/// - [`length`](crate::types::builders::SubstringBuilder::length)
pub fn build(self) -> ::std::result::Result<crate::types::Substring, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Substring {
start: self.start.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"start",
"start was not specified but it is required when building Substring",
)
})?,
length: self.length.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"length",
"length was not specified but it is required when building Substring",
)
})?,
})
}
}