docx_reader/documents/elements/
run_property_default.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
39
40
41
42
use serde::Serialize;

use super::*;

#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RunPropertyDefault {
	run_property: RunProperty,
}

impl RunPropertyDefault {
	pub fn new() -> RunPropertyDefault {
		Default::default()
	}

	pub fn size(mut self, size: usize) -> Self {
		self.run_property = self.run_property.size(size);
		self
	}

	pub fn spacing(mut self, spacing: i32) -> Self {
		self.run_property = self.run_property.spacing(spacing);
		self
	}

	pub fn fonts(mut self, font: RunFonts) -> Self {
		self.run_property = self.run_property.fonts(font);
		self
	}

	pub(crate) fn run_property(mut self, p: RunProperty) -> Self {
		self.run_property = p;
		self
	}
}

impl Default for RunPropertyDefault {
	fn default() -> Self {
		let run_property = RunProperty::new();
		RunPropertyDefault { run_property }
	}
}