diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-05 23:00:58 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-05 23:00:58 -0400 |
| commit | 05de3c7b211727039b3912311aa4bab6787a7457 (patch) | |
| tree | 08a3860b68391514390f42872ccc1cb4c6e6afd2 /src/channel/history.rs | |
| parent | bc514e0ea5f0a553f15ab8275961907877181520 (diff) | |
| parent | 6a10fcaf64938da52b326ea80013d9f30ed62a6c (diff) | |
Merge branch 'wip/boot'
Diffstat (limited to 'src/channel/history.rs')
| -rw-r--r-- | src/channel/history.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/channel/history.rs b/src/channel/history.rs index bd45d8d..383fb7b 100644 --- a/src/channel/history.rs +++ b/src/channel/history.rs @@ -2,7 +2,7 @@ use super::{ event::{Created, Deleted, Event}, Channel, Id, }; -use crate::event::Instant; +use crate::event::{Instant, ResumePoint, Sequence}; #[derive(Clone, Debug, Eq, PartialEq)] pub struct History { @@ -25,6 +25,12 @@ impl History { pub fn as_created(&self) -> Channel { self.channel.clone() } + + pub fn as_of(&self, resume_point: impl Into<ResumePoint>) -> Option<Channel> { + self.events() + .filter(Sequence::up_to(resume_point.into())) + .collect() + } } // Event factories |
