aws_sdk_appmesh/types/
_duration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object that represents a duration of time.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Duration {
7    /// <p>A number of time units.</p>
8    pub value: ::std::option::Option<i64>,
9    /// <p>A unit of time.</p>
10    pub unit: ::std::option::Option<crate::types::DurationUnit>,
11}
12impl Duration {
13    /// <p>A number of time units.</p>
14    pub fn value(&self) -> ::std::option::Option<i64> {
15        self.value
16    }
17    /// <p>A unit of time.</p>
18    pub fn unit(&self) -> ::std::option::Option<&crate::types::DurationUnit> {
19        self.unit.as_ref()
20    }
21}
22impl Duration {
23    /// Creates a new builder-style object to manufacture [`Duration`](crate::types::Duration).
24    pub fn builder() -> crate::types::builders::DurationBuilder {
25        crate::types::builders::DurationBuilder::default()
26    }
27}
28
29/// A builder for [`Duration`](crate::types::Duration).
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
31#[non_exhaustive]
32pub struct DurationBuilder {
33    pub(crate) value: ::std::option::Option<i64>,
34    pub(crate) unit: ::std::option::Option<crate::types::DurationUnit>,
35}
36impl DurationBuilder {
37    /// <p>A number of time units.</p>
38    pub fn value(mut self, input: i64) -> Self {
39        self.value = ::std::option::Option::Some(input);
40        self
41    }
42    /// <p>A number of time units.</p>
43    pub fn set_value(mut self, input: ::std::option::Option<i64>) -> Self {
44        self.value = input;
45        self
46    }
47    /// <p>A number of time units.</p>
48    pub fn get_value(&self) -> &::std::option::Option<i64> {
49        &self.value
50    }
51    /// <p>A unit of time.</p>
52    pub fn unit(mut self, input: crate::types::DurationUnit) -> Self {
53        self.unit = ::std::option::Option::Some(input);
54        self
55    }
56    /// <p>A unit of time.</p>
57    pub fn set_unit(mut self, input: ::std::option::Option<crate::types::DurationUnit>) -> Self {
58        self.unit = input;
59        self
60    }
61    /// <p>A unit of time.</p>
62    pub fn get_unit(&self) -> &::std::option::Option<crate::types::DurationUnit> {
63        &self.unit
64    }
65    /// Consumes the builder and constructs a [`Duration`](crate::types::Duration).
66    pub fn build(self) -> crate::types::Duration {
67        crate::types::Duration {
68            value: self.value,
69            unit: self.unit,
70        }
71    }
72}