docx_reader/documents/elements/
abstract_numbering.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use crate::documents::Level;

use serde::Serialize;

#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AbstractNumbering {
	pub id: usize,
	pub style_link: Option<String>,
	pub num_style_link: Option<String>,
	pub levels: Vec<Level>,
}

impl AbstractNumbering {
	pub fn new(id: usize) -> Self {
		Self {
			id,
			style_link: None,
			num_style_link: None,
			levels: vec![],
		}
	}

	pub fn add_level(mut self, level: Level) -> Self {
		self.levels.push(level);
		self
	}

	pub fn num_style_link(mut self, link: impl Into<String>) -> Self {
		self.num_style_link = Some(link.into());
		self
	}

	pub fn style_link(mut self, link: impl Into<String>) -> Self {
		self.style_link = Some(link.into());
		self
	}
}