umya_spreadsheet/structs/drawing/
alpha.rs1use crate::reader::driver::*;
3use crate::writer::driver::*;
4use quick_xml::events::BytesStart;
5use quick_xml::Reader;
6use quick_xml::Writer;
7use std::io::Cursor;
8
9#[derive(Clone, Default, Debug)]
10pub struct Alpha {
11 val: Box<str>,
12}
13impl Alpha {
14 #[inline]
15 pub fn get_val(&self) -> &str {
16 &self.val
17 }
18
19 #[inline]
20 pub fn set_val<S: Into<String>>(&mut self, value: S) {
21 self.val = value.into().into_boxed_str();
22 }
23
24 #[inline]
25 pub(crate) fn set_attributes<R: std::io::BufRead>(
26 &mut self,
27 _reader: &mut Reader<R>,
28 e: &BytesStart,
29 ) {
30 self.set_val(get_attribute(e, b"val").unwrap());
31 }
32
33 #[inline]
34 pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
35 write_start_tag(writer, "a:alpha", vec![("val", &self.val)], true);
37 }
38}