aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 04da2ca..9de5626 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -28,3 +28,15 @@ pub struct Mark {
pub struct Primstav {
pub marks: BTreeMap<String, Mark>,
}
+
+impl Primstav {
+ pub fn new(marks: BTreeMap<String, Mark>) -> Primstav {
+ Primstav { marks }
+ }
+
+ /// Get an entry for the given date if one exists.
+ pub fn get(&self, date: &chrono::NaiveDate) -> Option<&Mark> {
+ let key = date.format("%d%m").to_string();
+ self.marks.get(&key)
+ }
+}