Skip to main content

umya_spreadsheet/structs/drawing/
shape_guide.rs

1// a:gd
2use std::io::Cursor;
3
4use quick_xml::Writer;
5
6use crate::writer::driver::write_start_tag;
7
8#[derive(Clone, Default, Debug)]
9pub struct ShapeGuide {
10    name: Box<str>,
11    fmla: Box<str>,
12}
13impl ShapeGuide {
14    #[inline]
15    #[must_use]
16    pub fn name(&self) -> &str {
17        &self.name
18    }
19
20    #[inline]
21    #[must_use]
22    #[deprecated(since = "3.0.0", note = "Use name()")]
23    pub fn get_name(&self) -> &str {
24        self.name()
25    }
26
27    #[inline]
28    pub fn set_name<S: Into<String>>(&mut self, value: S) {
29        self.name = value.into().into_boxed_str();
30    }
31
32    #[inline]
33    #[must_use]
34    pub fn fmla(&self) -> &str {
35        &self.fmla
36    }
37
38    #[inline]
39    #[must_use]
40    #[deprecated(since = "3.0.0", note = "Use fmla()")]
41    pub fn get_fmla(&self) -> &str {
42        self.fmla()
43    }
44
45    #[inline]
46    pub fn set_fmla<S: Into<String>>(&mut self, value: S) {
47        self.fmla = value.into().into_boxed_str();
48    }
49
50    pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
51        write_start_tag(
52            writer,
53            "a:gd",
54            vec![("name", &self.name).into(), ("fmla", &self.fmla).into()],
55            true,
56        );
57    }
58}