summaryrefslogtreecommitdiff
path: root/src/event/sequence.rs
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-10-23 21:56:31 -0400
committerKit La Touche <kit@transneptune.net>2024-10-23 21:56:31 -0400
commit1f769855df2d9cf2bca883a0475670f227e3678b (patch)
tree6c94d9c868eb022588a07245df978478034ac5dd /src/event/sequence.rs
parent8f360dd9cc45bb14431238ccc5e3d137c020fa7b (diff)
parent461814e5174cef1be3e07b4e4069314e9bcbedd6 (diff)
Merge branch 'main' into wip/mobile
Diffstat (limited to 'src/event/sequence.rs')
-rw-r--r--src/event/sequence.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/event/sequence.rs b/src/event/sequence.rs
index bf6d5b8..9bc399b 100644
--- a/src/event/sequence.rs
+++ b/src/event/sequence.rs
@@ -10,6 +10,17 @@ pub struct Instant {
pub sequence: Sequence,
}
+impl Instant {
+ pub fn new(at: DateTime, sequence: Sequence) -> Self {
+ Self { at, sequence }
+ }
+
+ pub fn optional(at: Option<DateTime>, sequence: Option<Sequence>) -> Option<Self> {
+ at.zip(sequence)
+ .map(|(at, sequence)| Self::new(at, sequence))
+ }
+}
+
impl From<Instant> for Sequence {
fn from(instant: Instant) -> Self {
instant.sequence