docx_reader/documents/elements/outline_lvl.rs
1use serde::*;
2
3#[derive(Debug, Clone, PartialEq)]
4pub struct OutlineLvl {
5 pub v: usize,
6}
7
8impl OutlineLvl {
9 pub fn new(v: usize) -> OutlineLvl {
10 assert!(v < 10, "outline level should be less than 10");
11 OutlineLvl { v }
12 }
13}
14
15impl Serialize for OutlineLvl {
16 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
17 where
18 S: Serializer,
19 {
20 serializer.serialize_u32(self.v as u32)
21 }
22}