docx_rust/formatting/size.rs
1use hard_xml::{XmlRead, XmlWrite};
2
3use crate::__xml_test_suites;
4
5/// Size
6///
7/// ```rust
8/// use docx_rust::formatting::*;
9///
10/// let sz = Size::from(42isize);
11/// ```
12#[derive(Debug, XmlRead, XmlWrite, Clone)]
13#[cfg_attr(test, derive(PartialEq))]
14#[xml(tag = "w:sz")]
15pub struct Size {
16 #[xml(attr = "w:val")]
17 pub value: isize,
18}
19
20impl<T: Into<isize>> From<T> for Size {
21 fn from(val: T) -> Self {
22 Size { value: val.into() }
23 }
24}
25
26__xml_test_suites!(Size, Size::from(42isize), r#"<w:sz w:val="42"/>"#,);