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