diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-18 23:42:08 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-18 23:42:08 -0400 |
| commit | 82338ddcb7f14ffbd584a954689f02b6e6a7988e (patch) | |
| tree | 1e0a525766ca45067bb122cad3af69437db504ca /src/event/sequence.rs | |
| parent | bde5aea211e9838b4511a2b57c6a256fe89b66ab (diff) | |
| parent | 17b62b3458e3a992b93cd485b05d3fb112dd349a (diff) | |
Merge branch 'wip/retain-deleted'
Diffstat (limited to 'src/event/sequence.rs')
| -rw-r--r-- | src/event/sequence.rs | 11 |
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 |
