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