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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>An instance of a label returned by Amazon Rekognition Image (<code>DetectLabels</code>) or by Amazon Rekognition Video (<code>GetLabelDetection</code>).</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Instance {
    /// <p>The position of the label instance on the image.</p>
    pub bounding_box: ::std::option::Option<crate::types::BoundingBox>,
    /// <p>The confidence that Amazon Rekognition has in the accuracy of the bounding box.</p>
    pub confidence: ::std::option::Option<f32>,
    /// <p>The dominant colors found in an individual instance of a label.</p>
    pub dominant_colors: ::std::option::Option<::std::vec::Vec<crate::types::DominantColor>>,
}
impl Instance {
    /// <p>The position of the label instance on the image.</p>
    pub fn bounding_box(&self) -> ::std::option::Option<&crate::types::BoundingBox> {
        self.bounding_box.as_ref()
    }
    /// <p>The confidence that Amazon Rekognition has in the accuracy of the bounding box.</p>
    pub fn confidence(&self) -> ::std::option::Option<f32> {
        self.confidence
    }
    /// <p>The dominant colors found in an individual instance of a label.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.dominant_colors.is_none()`.
    pub fn dominant_colors(&self) -> &[crate::types::DominantColor] {
        self.dominant_colors.as_deref().unwrap_or_default()
    }
}
impl Instance {
    /// Creates a new builder-style object to manufacture [`Instance`](crate::types::Instance).
    pub fn builder() -> crate::types::builders::InstanceBuilder {
        crate::types::builders::InstanceBuilder::default()
    }
}

/// A builder for [`Instance`](crate::types::Instance).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct InstanceBuilder {
    pub(crate) bounding_box: ::std::option::Option<crate::types::BoundingBox>,
    pub(crate) confidence: ::std::option::Option<f32>,
    pub(crate) dominant_colors: ::std::option::Option<::std::vec::Vec<crate::types::DominantColor>>,
}
impl InstanceBuilder {
    /// <p>The position of the label instance on the image.</p>
    pub fn bounding_box(mut self, input: crate::types::BoundingBox) -> Self {
        self.bounding_box = ::std::option::Option::Some(input);
        self
    }
    /// <p>The position of the label instance on the image.</p>
    pub fn set_bounding_box(mut self, input: ::std::option::Option<crate::types::BoundingBox>) -> Self {
        self.bounding_box = input;
        self
    }
    /// <p>The position of the label instance on the image.</p>
    pub fn get_bounding_box(&self) -> &::std::option::Option<crate::types::BoundingBox> {
        &self.bounding_box
    }
    /// <p>The confidence that Amazon Rekognition has in the accuracy of the bounding box.</p>
    pub fn confidence(mut self, input: f32) -> Self {
        self.confidence = ::std::option::Option::Some(input);
        self
    }
    /// <p>The confidence that Amazon Rekognition has in the accuracy of the bounding box.</p>
    pub fn set_confidence(mut self, input: ::std::option::Option<f32>) -> Self {
        self.confidence = input;
        self
    }
    /// <p>The confidence that Amazon Rekognition has in the accuracy of the bounding box.</p>
    pub fn get_confidence(&self) -> &::std::option::Option<f32> {
        &self.confidence
    }
    /// Appends an item to `dominant_colors`.
    ///
    /// To override the contents of this collection use [`set_dominant_colors`](Self::set_dominant_colors).
    ///
    /// <p>The dominant colors found in an individual instance of a label.</p>
    pub fn dominant_colors(mut self, input: crate::types::DominantColor) -> Self {
        let mut v = self.dominant_colors.unwrap_or_default();
        v.push(input);
        self.dominant_colors = ::std::option::Option::Some(v);
        self
    }
    /// <p>The dominant colors found in an individual instance of a label.</p>
    pub fn set_dominant_colors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::DominantColor>>) -> Self {
        self.dominant_colors = input;
        self
    }
    /// <p>The dominant colors found in an individual instance of a label.</p>
    pub fn get_dominant_colors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::DominantColor>> {
        &self.dominant_colors
    }
    /// Consumes the builder and constructs a [`Instance`](crate::types::Instance).
    pub fn build(self) -> crate::types::Instance {
        crate::types::Instance {
            bounding_box: self.bounding_box,
            confidence: self.confidence,
            dominant_colors: self.dominant_colors,
        }
    }
}