OwnedEvent, OwnedFilter

This commit is contained in:
Mike Dilger 2024-02-13 14:24:45 +13:00
parent e378df2865
commit 0a228680c2
3 changed files with 20 additions and 2 deletions

View File

@ -128,3 +128,12 @@ impl fmt::Display for Event<'_> {
}
}
}
#[derive(Debug, Clone)]
pub struct OwnedEvent(pub Vec<u8>);
impl OwnedEvent {
pub fn as_event(&self) -> Result<Event<'_>, Error> {
Event::delineate(&self.0)
}
}

View File

@ -419,6 +419,15 @@ impl<'a> Iterator for FilterKindIter<'a> {
}
}
#[derive(Debug, Clone)]
pub struct OwnedFilter(pub Vec<u8>);
impl OwnedFilter {
pub fn as_filter(&self) -> Result<Filter<'_>, Error> {
Filter::delineate(&self.0)
}
}
#[cfg(test)]
mod test {
use super::*;

View File

@ -1,8 +1,8 @@
mod event;
pub use event::Event;
pub use event::{Event, OwnedEvent};
mod filter;
pub use filter::Filter;
pub use filter::{Filter, OwnedFilter};
mod id;
pub use id::Id;