docx_reader/documents/elements/justification.rs
1use serde::{Serialize, Serializer};
2
3// 22.1.2.51
4// jc (Justification)
5// This element specifies justification of the math paragraph (a series of adjacent instances of mathematical text
6// within the same paragraph). A math paragraph can be Left Justified, Right Justified, Centered, or Centered as
7// Group. If this element is omitted, the math paragraph is Centered as Group. Whether the element is absent or
8// present without the val attribute, the default of the val attribute is centerGroup . This means that the instances
9// of mathematical text can be aligned with respect to each other, but the entire group of mathematical text is
10// centered as a whole.
11#[derive(Debug, Clone, PartialEq)]
12pub struct Justification {
13 pub val: String,
14}
15
16impl Justification {
17 pub fn new(val: impl Into<String>) -> Justification {
18 Justification { val: val.into() }
19 }
20}
21
22impl Serialize for Justification {
23 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
24 where
25 S: Serializer,
26 {
27 serializer.serialize_str(&self.val)
28 }
29}