aboutsummaryrefslogtreecommitdiff
path: root/karlcommon/src/misc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'karlcommon/src/misc.rs')
-rw-r--r--karlcommon/src/misc.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/karlcommon/src/misc.rs b/karlcommon/src/misc.rs
new file mode 100644
index 0000000..583ed27
--- /dev/null
+++ b/karlcommon/src/misc.rs
@@ -0,0 +1,30 @@
+use crate::Property;
+
+impl Property {
+ pub const VALUES: &'static [Property] = &[
+ Property::Year,
+ Property::Monthofyear,
+ Property::Weekofmonth,
+ Property::Dayofyear,
+ Property::Dayofmonth,
+ Property::Dayofweek,
+ Property::Hour,
+ Property::Minute,
+ Property::Second,
+ Property::Unix,
+ ];
+ pub fn to_str(self) -> &'static str {
+ match self {
+ Property::Year => "Year",
+ Property::Monthofyear => "Month of the year",
+ Property::Weekofmonth => "Week of the month",
+ Property::Dayofyear => "Day of the year",
+ Property::Dayofmonth => "Day of the month",
+ Property::Dayofweek => "Day of the week",
+ Property::Hour => "Hour",
+ Property::Minute => "Minute",
+ Property::Second => "Second",
+ Property::Unix => "Unix timestamp",
+ }
+ }
+}