docx_rs/documents/elements/
footer_reference.rs

1use crate::documents::BuildXML;
2use crate::xml_builder::*;
3use std::io::Write;
4
5use serde::Serialize;
6
7#[derive(Debug, Clone, PartialEq, Serialize)]
8#[serde(rename_all = "camelCase")]
9pub struct FooterReference {
10    pub footer_type: String,
11    pub id: String,
12}
13
14impl FooterReference {
15    pub fn new(t: impl Into<String>, id: impl Into<String>) -> FooterReference {
16        FooterReference {
17            footer_type: t.into(),
18            id: id.into(),
19        }
20    }
21}
22
23impl BuildXML for FooterReference {
24    fn build_to<W: Write>(
25        &self,
26        stream: xml::writer::EventWriter<W>,
27    ) -> xml::writer::Result<xml::writer::EventWriter<W>> {
28        XMLBuilder::from(stream)
29            .footer_reference(&self.footer_type, &self.id)?
30            .into_inner()
31    }
32}