docx_reader/documents/elements/
paragraph_property_change.rs1use serde::Serialize;
2
3use crate::documents::*;
4
5#[derive(Serialize, Debug, Clone, PartialEq)]
6#[serde(rename_all = "camelCase")]
7pub struct ParagraphPropertyChange {
8 pub author: String,
9 pub date: String,
10 pub property: Box<ParagraphProperty>,
11}
12
13impl Default for ParagraphPropertyChange {
14 fn default() -> ParagraphPropertyChange {
15 Self {
16 author: "unnamed".to_owned(),
17 date: "1970-01-01T00:00:00Z".to_owned(),
18 property: Box::new(ParagraphProperty::default()),
19 }
20 }
21}
22
23impl ParagraphPropertyChange {
24 pub fn new() -> ParagraphPropertyChange {
25 Self {
26 ..Default::default()
27 }
28 }
29
30 pub fn property(mut self, p: ParagraphProperty) -> ParagraphPropertyChange {
31 self.property = Box::new(p);
32 self
33 }
34
35 pub fn author(mut self, author: impl Into<String>) -> ParagraphPropertyChange {
36 self.author = author.into();
37 self
38 }
39
40 pub fn date(mut self, date: impl Into<String>) -> ParagraphPropertyChange {
41 self.date = date.into();
42 self
43 }
44}