summaryrefslogtreecommitdiff
path: root/src/message/history.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-05 22:42:43 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-05 22:47:12 -0400
commit6a10fcaf64938da52b326ea80013d9f30ed62a6c (patch)
tree08a3860b68391514390f42872ccc1cb4c6e6afd2 /src/message/history.rs
parent1fb26ad31d385ddc628e1b73d6a8764981ca6885 (diff)
Separate `/api/boot` into its own module.
Diffstat (limited to 'src/message/history.rs')
-rw-r--r--src/message/history.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/message/history.rs b/src/message/history.rs
index c44d954..f267f4c 100644
--- a/src/message/history.rs
+++ b/src/message/history.rs
@@ -2,7 +2,7 @@ use super::{
event::{Deleted, Event, Sent},
Id, Message,
};
-use crate::event::Instant;
+use crate::event::{Instant, ResumePoint, Sequence};
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct History {
@@ -24,6 +24,12 @@ impl History {
pub fn as_sent(&self) -> Message {
self.message.clone()
}
+
+ pub fn as_of(&self, resume_point: impl Into<ResumePoint>) -> Option<Message> {
+ self.events()
+ .filter(Sequence::up_to(resume_point.into()))
+ .collect()
+ }
}
// Events interface