umya_spreadsheet/structs/
bold.rs1use std::io::Cursor;
3
4use quick_xml::{
5 Reader,
6 Writer,
7 events::BytesStart,
8};
9
10use super::BooleanValue;
11use crate::{
12 reader::driver::{
13 get_attribute,
14 set_string_from_xml,
15 },
16 writer::driver::write_start_tag,
17};
18
19#[derive(Clone, Default, Debug, Eq, Ord, PartialEq, PartialOrd)]
20pub struct Bold {
21 pub(crate) val: BooleanValue,
22}
23
24impl Bold {
25 #[inline]
26 #[must_use]
27 pub fn val(&self) -> bool {
28 self.val.value()
29 }
30
31 #[inline]
32 #[must_use]
33 #[deprecated(since = "3.0.0", note = "Use val()")]
34 pub fn get_val(&self) -> bool {
35 self.val()
36 }
37
38 #[inline]
39 pub fn set_val(&mut self, value: bool) -> &mut Self {
40 self.val.set_value(value);
41 self
42 }
43
44 #[inline]
45 pub(crate) fn set_attributes<R: std::io::BufRead>(
46 &mut self,
47 _reader: &mut Reader<R>,
48 e: &BytesStart,
49 ) {
50 self.val.set_value(true);
51 set_string_from_xml!(self, e, val, "val");
52 }
53
54 #[inline]
55 pub(crate) fn write_to(&self, writer: &mut Writer<Cursor<Vec<u8>>>) {
56 if self.val.value() {
58 write_start_tag(writer, "b", vec![], true);
59 }
60 }
61}