docx-rs/docx-core/src/documents/elements/bold_cs.rs

42 lines
767 B
Rust
Raw Normal View History

use serde::{Deserialize, Serialize, Serializer};
2019-11-13 09:08:25 +02:00
use crate::documents::BuildXML;
use crate::xml_builder::*;
#[derive(Debug, Clone, Deserialize, PartialEq)]
2021-03-16 10:41:36 +02:00
pub struct BoldCs {
val: bool,
}
2019-11-13 09:08:25 +02:00
impl BoldCs {
pub fn new() -> BoldCs {
Default::default()
}
2021-03-16 10:41:36 +02:00
pub fn disable(mut self) -> BoldCs {
self.val = false;
self
}
}
impl Default for BoldCs {
fn default() -> Self {
2021-03-16 10:41:36 +02:00
Self { val: true }
2019-11-13 09:08:25 +02:00
}
}
impl Serialize for BoldCs {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
2021-03-16 10:41:36 +02:00
serializer.serialize_bool(self.val)
}
}
2019-11-13 09:08:25 +02:00
impl BuildXML for BoldCs {
fn build(&self) -> Vec<u8> {
let b = XMLBuilder::new();
b.b_cs().build()
}
}