#[non_exhaustive]pub struct Document {Show 17 fields
pub docid: String,
pub mime_type: String,
pub text: String,
pub text_styles: Vec<Style>,
pub pages: Vec<Page>,
pub entities: Vec<Entity>,
pub entity_relations: Vec<EntityRelation>,
pub text_changes: Vec<TextChange>,
pub shard_info: Option<ShardInfo>,
pub error: Option<Status>,
pub revisions: Vec<Revision>,
pub document_layout: Option<DocumentLayout>,
pub chunked_document: Option<ChunkedDocument>,
pub entity_validation_output: Option<EntityValidationOutput>,
pub entities_revisions: Vec<EntitiesRevision>,
pub entities_revision_id: String,
pub source: Option<Source>,
/* private fields */
}Expand description
Document represents the canonical document resource in Document AI. It is an interchange format that provides insights into documents and allows for collaboration between users and Document AI to iterate and optimize for quality.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.docid: StringOptional. An internal identifier for document. Should be loggable (no PII).
mime_type: StringAn IANA published media type (MIME type).
text: StringOptional. UTF-8 encoded text in reading order from the document.
text_styles: Vec<Style>Styles for the Document.text.
pages: Vec<Page>Visual page layout for the Document.
entities: Vec<Entity>A list of entities detected on Document.text. For document shards, entities in this list may cross shard boundaries.
entity_relations: Vec<EntityRelation>Placeholder. Relationship among Document.entities.
text_changes: Vec<TextChange>Placeholder. A list of text corrections made to Document.text. This is usually used for annotating corrections to OCR mistakes. Text changes for a given revision may not overlap with each other.
shard_info: Option<ShardInfo>Information about the sharding if this document is sharded part of a larger document. If the document is not sharded, this message is not specified.
error: Option<Status>Any error that occurred while processing this document.
revisions: Vec<Revision>Placeholder. Revision history of this document.
document_layout: Option<DocumentLayout>Parsed layout of the document.
chunked_document: Option<ChunkedDocument>Document chunked based on chunking config.
entity_validation_output: Option<EntityValidationOutput>The entity validation output for the document. This is the validation
output for document.entities field.
entities_revisions: Vec<EntitiesRevision>A list of entity revisions. The entity revisions are appended to the document in the processing order. This field can be used for comparing the entity extraction results at different stages of the processing.
entities_revision_id: StringThe entity revision id that document.entities field is based on.
If this field is set and entities_revisions is not empty, the entities in
document.entities field are the entities in the entity revision with this
id and document.entity_validation_output field is the
entity_validation_output field in this entity revision.
source: Option<Source>Original source document from the user.
Implementations§
Source§impl Document
impl Document
pub fn new() -> Self
Sourcepub fn set_mime_type<T: Into<String>>(self, v: T) -> Self
pub fn set_mime_type<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_text_styles<T, V>(self, v: T) -> Self
👎Deprecated
pub fn set_text_styles<T, V>(self, v: T) -> Self
Sets the value of text_styles.
§Example
use google_cloud_documentai_v1::model::document::Style;
let x = Document::new()
.set_text_styles([
Style::default()/* use setters */,
Style::default()/* use (different) setters */,
]);Sourcepub fn set_entities<T, V>(self, v: T) -> Self
pub fn set_entities<T, V>(self, v: T) -> Self
Sourcepub fn set_entity_relations<T, V>(self, v: T) -> Self
pub fn set_entity_relations<T, V>(self, v: T) -> Self
Sets the value of entity_relations.
§Example
use google_cloud_documentai_v1::model::document::EntityRelation;
let x = Document::new()
.set_entity_relations([
EntityRelation::default()/* use setters */,
EntityRelation::default()/* use (different) setters */,
]);Sourcepub fn set_text_changes<T, V>(self, v: T) -> Self
pub fn set_text_changes<T, V>(self, v: T) -> Self
Sets the value of text_changes.
§Example
use google_cloud_documentai_v1::model::document::TextChange;
let x = Document::new()
.set_text_changes([
TextChange::default()/* use setters */,
TextChange::default()/* use (different) setters */,
]);Sourcepub fn set_shard_info<T>(self, v: T) -> Self
pub fn set_shard_info<T>(self, v: T) -> Self
Sets the value of shard_info.
§Example
use google_cloud_documentai_v1::model::document::ShardInfo;
let x = Document::new().set_shard_info(ShardInfo::default()/* use setters */);Sourcepub fn set_or_clear_shard_info<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_shard_info<T>(self, v: Option<T>) -> Self
Sets or clears the value of shard_info.
§Example
use google_cloud_documentai_v1::model::document::ShardInfo;
let x = Document::new().set_or_clear_shard_info(Some(ShardInfo::default()/* use setters */));
let x = Document::new().set_or_clear_shard_info(None::<ShardInfo>);Sourcepub fn set_or_clear_error<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_error<T>(self, v: Option<T>) -> Self
Sourcepub fn set_revisions<T, V>(self, v: T) -> Self
pub fn set_revisions<T, V>(self, v: T) -> Self
Sourcepub fn set_document_layout<T>(self, v: T) -> Selfwhere
T: Into<DocumentLayout>,
pub fn set_document_layout<T>(self, v: T) -> Selfwhere
T: Into<DocumentLayout>,
Sets the value of document_layout.
§Example
use google_cloud_documentai_v1::model::document::DocumentLayout;
let x = Document::new().set_document_layout(DocumentLayout::default()/* use setters */);Sourcepub fn set_or_clear_document_layout<T>(self, v: Option<T>) -> Selfwhere
T: Into<DocumentLayout>,
pub fn set_or_clear_document_layout<T>(self, v: Option<T>) -> Selfwhere
T: Into<DocumentLayout>,
Sets or clears the value of document_layout.
§Example
use google_cloud_documentai_v1::model::document::DocumentLayout;
let x = Document::new().set_or_clear_document_layout(Some(DocumentLayout::default()/* use setters */));
let x = Document::new().set_or_clear_document_layout(None::<DocumentLayout>);Sourcepub fn set_chunked_document<T>(self, v: T) -> Selfwhere
T: Into<ChunkedDocument>,
pub fn set_chunked_document<T>(self, v: T) -> Selfwhere
T: Into<ChunkedDocument>,
Sets the value of chunked_document.
§Example
use google_cloud_documentai_v1::model::document::ChunkedDocument;
let x = Document::new().set_chunked_document(ChunkedDocument::default()/* use setters */);Sourcepub fn set_or_clear_chunked_document<T>(self, v: Option<T>) -> Selfwhere
T: Into<ChunkedDocument>,
pub fn set_or_clear_chunked_document<T>(self, v: Option<T>) -> Selfwhere
T: Into<ChunkedDocument>,
Sets or clears the value of chunked_document.
§Example
use google_cloud_documentai_v1::model::document::ChunkedDocument;
let x = Document::new().set_or_clear_chunked_document(Some(ChunkedDocument::default()/* use setters */));
let x = Document::new().set_or_clear_chunked_document(None::<ChunkedDocument>);Sourcepub fn set_entity_validation_output<T>(self, v: T) -> Selfwhere
T: Into<EntityValidationOutput>,
pub fn set_entity_validation_output<T>(self, v: T) -> Selfwhere
T: Into<EntityValidationOutput>,
Sets the value of entity_validation_output.
§Example
use google_cloud_documentai_v1::model::document::EntityValidationOutput;
let x = Document::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);Sourcepub fn set_or_clear_entity_validation_output<T>(self, v: Option<T>) -> Selfwhere
T: Into<EntityValidationOutput>,
pub fn set_or_clear_entity_validation_output<T>(self, v: Option<T>) -> Selfwhere
T: Into<EntityValidationOutput>,
Sets or clears the value of entity_validation_output.
§Example
use google_cloud_documentai_v1::model::document::EntityValidationOutput;
let x = Document::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
let x = Document::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);Sourcepub fn set_entities_revisions<T, V>(self, v: T) -> Self
pub fn set_entities_revisions<T, V>(self, v: T) -> Self
Sets the value of entities_revisions.
§Example
use google_cloud_documentai_v1::model::document::EntitiesRevision;
let x = Document::new()
.set_entities_revisions([
EntitiesRevision::default()/* use setters */,
EntitiesRevision::default()/* use (different) setters */,
]);Sourcepub fn set_entities_revision_id<T: Into<String>>(self, v: T) -> Self
pub fn set_entities_revision_id<T: Into<String>>(self, v: T) -> Self
Sets the value of entities_revision_id.
§Example
let x = Document::new().set_entities_revision_id("example");Sourcepub fn set_source<T: Into<Option<Source>>>(self, v: T) -> Self
pub fn set_source<T: Into<Option<Source>>>(self, v: T) -> Self
Sourcepub fn uri(&self) -> Option<&String>
pub fn uri(&self) -> Option<&String>
The value of source
if it holds a Uri, None if the field is not set or
holds a different branch.
Sourcepub fn content(&self) -> Option<&Bytes>
pub fn content(&self) -> Option<&Bytes>
The value of source
if it holds a Content, None if the field is not set or
holds a different branch.