summaryrefslogtreecommitdiffstats
path: root/src/session.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/session.rs')
-rw-r--r--src/session.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/session.rs b/src/session.rs
index ea3cc75..fd5137e 100644
--- a/src/session.rs
+++ b/src/session.rs
@@ -90,3 +90,16 @@ impl From<String> for Session {
}
}
+impl From<(String, State)> for Session {
+ fn from((name, state): (String, State)) -> Self {
+ let timestamp = SystemTime::now()
+ .duration_since(UNIX_EPOCH)
+ .expect("Current time is pre-epoch. (Time traveler?)");
+
+ Self {
+ state,
+ timestamp,
+ name,
+ }
+ }
+}