umya_spreadsheet/structs/
u_int32_value.rs1#[derive(Clone, Default, Debug, Eq, Ord, PartialEq, PartialOrd)]
2pub struct UInt32Value {
3 value: Option<u32>,
4}
5impl UInt32Value {
6 #[inline]
7 pub(crate) fn get_value(&self) -> &u32 {
8 self.value.as_ref().unwrap_or(&0)
9 }
10
11 #[inline]
12 pub(crate) fn get_value_string(&self) -> String {
13 self.get_value().to_string()
14 }
15
16 #[inline]
17 pub(crate) fn set_value(&mut self, value: u32) -> &mut Self {
18 self.value = Some(value);
19 self
20 }
21
22 #[inline]
23 pub(crate) fn set_value_string<S: Into<String>>(&mut self, value: S) -> &mut Self {
24 self.set_value(value.into().parse::<u32>().unwrap())
25 }
26
27 #[inline]
28 pub(crate) fn remove_value(&mut self) -> &mut Self {
29 self.value = None;
30 self
31 }
32
33 #[inline]
34 pub(crate) fn has_value(&self) -> bool {
35 self.value.is_some()
36 }
37
38 #[inline]
39 pub(crate) fn get_hash_string(&self) -> String {
40 if self.has_value() {
41 return self.get_value_string();
42 }
43 String::from("empty!!")
44 }
45}