aboutsummaryrefslogtreecommitdiff
path: root/karlcommon
diff options
context:
space:
mode:
authormetamuffin <yvchraiqi@protonmail.com>2022-08-16 17:16:15 +0200
committermetamuffin <yvchraiqi@protonmail.com>2022-08-16 17:16:15 +0200
commit9a306095aa701f372242f3dcbb76a09b4694762d (patch)
treece16cf8191678b71405dbe8081d194282c7bfa31 /karlcommon
parente247646c36fe2ba0133a3354204ca5b0e873b041 (diff)
downloadkarlender-9a306095aa701f372242f3dcbb76a09b4694762d.tar
karlender-9a306095aa701f372242f3dcbb76a09b4694762d.tar.bz2
karlender-9a306095aa701f372242f3dcbb76a09b4694762d.tar.zst
first editable
Diffstat (limited to 'karlcommon')
-rw-r--r--karlcommon/src/lib.rs1
-rw-r--r--karlcommon/src/misc.rs30
2 files changed, 31 insertions, 0 deletions
diff --git a/karlcommon/src/lib.rs b/karlcommon/src/lib.rs
index f9cd9d4..bbe8b1e 100644
--- a/karlcommon/src/lib.rs
+++ b/karlcommon/src/lib.rs
@@ -1,5 +1,6 @@
pub mod protocol;
pub use protocol::*;
+pub mod misc;
use std::{
os::unix::prelude::MetadataExt,
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",
+ }
+ }
+}