docx_reader/documents/elements/
table_of_contents_item.rsuse serde::Serialize;
use crate::documents::*;
#[derive(Serialize, Debug, Clone, PartialEq, Default)]
pub struct TableOfContentsItem {
pub instr: InstrToC,
pub text: String,
pub toc_key: String,
pub level: usize,
pub dirty: bool,
pub page_ref: Option<String>,
}
impl TableOfContentsItem {
pub fn new() -> Self {
Self {
level: 1,
..Default::default()
}
}
pub fn instr(mut self, instr: InstrToC) -> Self {
self.instr = instr;
self
}
pub fn text(mut self, text: impl Into<String>) -> Self {
self.text = text.into();
self
}
pub fn level(mut self, level: usize) -> Self {
self.level = level;
self
}
pub fn toc_key(mut self, key: impl Into<String>) -> Self {
self.toc_key = key.into();
self
}
pub fn page_ref(mut self, r: impl Into<String>) -> Self {
self.page_ref = Some(r.into());
self
}
}