docx_reader/documents/elements/
paragraph_property_change.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
43
44
use serde::Serialize;

use crate::documents::*;

#[derive(Serialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct ParagraphPropertyChange {
	pub author: String,
	pub date: String,
	pub property: Box<ParagraphProperty>,
}

impl Default for ParagraphPropertyChange {
	fn default() -> ParagraphPropertyChange {
		Self {
			author: "unnamed".to_owned(),
			date: "1970-01-01T00:00:00Z".to_owned(),
			property: Box::new(ParagraphProperty::default()),
		}
	}
}

impl ParagraphPropertyChange {
	pub fn new() -> ParagraphPropertyChange {
		Self {
			..Default::default()
		}
	}

	pub fn property(mut self, p: ParagraphProperty) -> ParagraphPropertyChange {
		self.property = Box::new(p);
		self
	}

	pub fn author(mut self, author: impl Into<String>) -> ParagraphPropertyChange {
		self.author = author.into();
		self
	}

	pub fn date(mut self, date: impl Into<String>) -> ParagraphPropertyChange {
		self.date = date.into();
		self
	}
}