Skip to main content

aws_sdk_comprehend/types/
_document_label.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Specifies one of the label or labels that categorize the document being analyzed.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DocumentLabel {
7    /// <p>The name of the label.</p>
8    pub name: ::std::option::Option<::std::string::String>,
9    /// <p>The confidence score that Amazon Comprehend has this label correctly attributed.</p>
10    pub score: ::std::option::Option<f32>,
11    /// <p>Page number where the label occurs. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
12    pub page: ::std::option::Option<i32>,
13}
14impl DocumentLabel {
15    /// <p>The name of the label.</p>
16    pub fn name(&self) -> ::std::option::Option<&str> {
17        self.name.as_deref()
18    }
19    /// <p>The confidence score that Amazon Comprehend has this label correctly attributed.</p>
20    pub fn score(&self) -> ::std::option::Option<f32> {
21        self.score
22    }
23    /// <p>Page number where the label occurs. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
24    pub fn page(&self) -> ::std::option::Option<i32> {
25        self.page
26    }
27}
28impl DocumentLabel {
29    /// Creates a new builder-style object to manufacture [`DocumentLabel`](crate::types::DocumentLabel).
30    pub fn builder() -> crate::types::builders::DocumentLabelBuilder {
31        crate::types::builders::DocumentLabelBuilder::default()
32    }
33}
34
35/// A builder for [`DocumentLabel`](crate::types::DocumentLabel).
36#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
37#[non_exhaustive]
38pub struct DocumentLabelBuilder {
39    pub(crate) name: ::std::option::Option<::std::string::String>,
40    pub(crate) score: ::std::option::Option<f32>,
41    pub(crate) page: ::std::option::Option<i32>,
42}
43impl DocumentLabelBuilder {
44    /// <p>The name of the label.</p>
45    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
46        self.name = ::std::option::Option::Some(input.into());
47        self
48    }
49    /// <p>The name of the label.</p>
50    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
51        self.name = input;
52        self
53    }
54    /// <p>The name of the label.</p>
55    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
56        &self.name
57    }
58    /// <p>The confidence score that Amazon Comprehend has this label correctly attributed.</p>
59    pub fn score(mut self, input: f32) -> Self {
60        self.score = ::std::option::Option::Some(input);
61        self
62    }
63    /// <p>The confidence score that Amazon Comprehend has this label correctly attributed.</p>
64    pub fn set_score(mut self, input: ::std::option::Option<f32>) -> Self {
65        self.score = input;
66        self
67    }
68    /// <p>The confidence score that Amazon Comprehend has this label correctly attributed.</p>
69    pub fn get_score(&self) -> &::std::option::Option<f32> {
70        &self.score
71    }
72    /// <p>Page number where the label occurs. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
73    pub fn page(mut self, input: i32) -> Self {
74        self.page = ::std::option::Option::Some(input);
75        self
76    }
77    /// <p>Page number where the label occurs. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
78    pub fn set_page(mut self, input: ::std::option::Option<i32>) -> Self {
79        self.page = input;
80        self
81    }
82    /// <p>Page number where the label occurs. This field is present in the response only if your request includes the <code>Byte</code> parameter.</p>
83    pub fn get_page(&self) -> &::std::option::Option<i32> {
84        &self.page
85    }
86    /// Consumes the builder and constructs a [`DocumentLabel`](crate::types::DocumentLabel).
87    pub fn build(self) -> crate::types::DocumentLabel {
88        crate::types::DocumentLabel {
89            name: self.name,
90            score: self.score,
91            page: self.page,
92        }
93    }
94}