summaryrefslogtreecommitdiff
path: root/src/channel/history.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/channel/history.rs')
-rw-r--r--src/channel/history.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/channel/history.rs b/src/channel/history.rs
index 7f18e45..85da5a5 100644
--- a/src/channel/history.rs
+++ b/src/channel/history.rs
@@ -27,6 +27,15 @@ impl History {
self.channel.clone()
}
+ pub fn as_of<S>(&self, sequence: S) -> Option<Channel>
+ where
+ S: Into<Sequence>,
+ {
+ self.events()
+ .filter(Sequence::up_to(sequence.into()))
+ .collect()
+ }
+
// Snapshot of this channel as of all events recorded in this history.
pub fn as_snapshot(&self) -> Option<Channel> {
self.events().collect()