docx_rs/documents/elements/
bold_cs.rs1use serde::{Deserialize, Serialize, Serializer};
2use std::io::Write;
3
4use crate::documents::BuildXML;
5use crate::xml_builder::*;
6
7#[derive(Debug, Clone, Deserialize, PartialEq)]
8pub struct BoldCs {
9 val: bool,
10}
11
12impl BoldCs {
13 pub fn new() -> BoldCs {
14 Default::default()
15 }
16 pub fn disable(mut self) -> BoldCs {
17 self.val = false;
18 self
19 }
20}
21
22impl Default for BoldCs {
23 fn default() -> Self {
24 Self { val: true }
25 }
26}
27
28impl Serialize for BoldCs {
29 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
30 where
31 S: Serializer,
32 {
33 serializer.serialize_bool(self.val)
34 }
35}
36
37impl BuildXML for BoldCs {
38 fn build_to<W: Write>(
39 &self,
40 stream: xml::writer::EventWriter<W>,
41 ) -> xml::writer::Result<xml::writer::EventWriter<W>> {
42 XMLBuilder::from(stream).b_cs()?.into_inner()
43 }
44}