aws-sdk-comprehend 1.98.0

AWS SDK for Amazon Comprehend
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Information about the location of items on a document page.</p>
/// <p>For additional information, see <a href="https://docs.aws.amazon.com/textract/latest/dg/API_Geometry.html">Geometry</a> in the Amazon Textract API reference.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Geometry {
    /// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
    pub bounding_box: ::std::option::Option<crate::types::BoundingBox>,
    /// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
    pub polygon: ::std::option::Option<::std::vec::Vec<crate::types::Point>>,
}
impl Geometry {
    /// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
    pub fn bounding_box(&self) -> ::std::option::Option<&crate::types::BoundingBox> {
        self.bounding_box.as_ref()
    }
    /// <p>Within the bounding box, a fine-grained polygon around the recognized item.</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 `.polygon.is_none()`.
    pub fn polygon(&self) -> &[crate::types::Point] {
        self.polygon.as_deref().unwrap_or_default()
    }
}
impl Geometry {
    /// Creates a new builder-style object to manufacture [`Geometry`](crate::types::Geometry).
    pub fn builder() -> crate::types::builders::GeometryBuilder {
        crate::types::builders::GeometryBuilder::default()
    }
}

/// A builder for [`Geometry`](crate::types::Geometry).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GeometryBuilder {
    pub(crate) bounding_box: ::std::option::Option<crate::types::BoundingBox>,
    pub(crate) polygon: ::std::option::Option<::std::vec::Vec<crate::types::Point>>,
}
impl GeometryBuilder {
    /// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
    pub fn bounding_box(mut self, input: crate::types::BoundingBox) -> Self {
        self.bounding_box = ::std::option::Option::Some(input);
        self
    }
    /// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
    pub fn set_bounding_box(mut self, input: ::std::option::Option<crate::types::BoundingBox>) -> Self {
        self.bounding_box = input;
        self
    }
    /// <p>An axis-aligned coarse representation of the location of the recognized item on the document page.</p>
    pub fn get_bounding_box(&self) -> &::std::option::Option<crate::types::BoundingBox> {
        &self.bounding_box
    }
    /// Appends an item to `polygon`.
    ///
    /// To override the contents of this collection use [`set_polygon`](Self::set_polygon).
    ///
    /// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
    pub fn polygon(mut self, input: crate::types::Point) -> Self {
        let mut v = self.polygon.unwrap_or_default();
        v.push(input);
        self.polygon = ::std::option::Option::Some(v);
        self
    }
    /// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
    pub fn set_polygon(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Point>>) -> Self {
        self.polygon = input;
        self
    }
    /// <p>Within the bounding box, a fine-grained polygon around the recognized item.</p>
    pub fn get_polygon(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Point>> {
        &self.polygon
    }
    /// Consumes the builder and constructs a [`Geometry`](crate::types::Geometry).
    pub fn build(self) -> crate::types::Geometry {
        crate::types::Geometry {
            bounding_box: self.bounding_box,
            polygon: self.polygon,
        }
    }
}