docx_reader/documents/elements/
paragraph_style.rs1use serde::{Serialize, Serializer};
2
3#[derive(Debug, Clone, PartialEq)]
4pub struct ParagraphStyle {
5 pub val: String,
6}
7
8impl Default for ParagraphStyle {
9 fn default() -> Self {
10 ParagraphStyle {
11 val: "Normal".to_owned(),
12 }
13 }
14}
15
16impl ParagraphStyle {
23 pub fn new(val: Option<impl Into<String>>) -> ParagraphStyle {
24 if let Some(v) = val {
25 ParagraphStyle { val: v.into() }
26 } else {
27 Default::default()
28 }
29 }
30}
31
32impl Serialize for ParagraphStyle {
33 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
34 where
35 S: Serializer,
36 {
37 serializer.serialize_str(&self.val)
38 }
39}