docx_rs/documents/elements/
table_style.rs1use serde::{Serialize, Serializer};
2use std::io::Write;
3
4use crate::documents::BuildXML;
5use crate::xml_builder::*;
6
7#[derive(Debug, Clone, PartialEq)]
8pub struct TableStyle {
9 val: String,
10}
11
12impl TableStyle {
13 pub fn new(val: impl Into<String>) -> TableStyle {
14 TableStyle { val: val.into() }
15 }
16}
17
18impl BuildXML for TableStyle {
19 fn build_to<W: Write>(
20 &self,
21 stream: xml::writer::EventWriter<W>,
22 ) -> xml::writer::Result<xml::writer::EventWriter<W>> {
23 XMLBuilder::from(stream)
24 .table_style(&self.val)?
25 .into_inner()
26 }
27}
28
29impl Serialize for TableStyle {
30 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
31 where
32 S: Serializer,
33 {
34 serializer.serialize_str(&self.val)
35 }
36}