docx_reader/documents/
document_rels.rsuse serde::Serialize;
#[derive(Debug, Clone, PartialEq, Serialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DocumentRels {
pub has_comments: bool,
pub has_numberings: bool,
pub images: Vec<(String, String)>,
pub hyperlinks: Vec<(String, String, String)>,
pub custom_xml_count: usize,
pub header_count: usize,
pub footer_count: usize,
}
impl DocumentRels {
pub fn new() -> DocumentRels {
Default::default()
}
pub fn add_custom_item(mut self) -> Self {
self.custom_xml_count += 1;
self
}
pub fn add_image(mut self, id: impl Into<String>, path: impl Into<String>) -> Self {
self.images.push((id.into(), path.into()));
self
}
pub fn add_hyperlinks(
mut self,
id: impl Into<String>,
path: impl Into<String>,
r#type: impl Into<String>,
) -> Self {
self.hyperlinks
.push((id.into(), path.into(), r#type.into()));
self
}
}