-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: make event msg generic * feat: add test for minimal custom event msg
- Loading branch information
Showing
34 changed files
with
412 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
use std::marker::PhantomData; | ||
|
||
use crate::publisher::{CaptureControl, Id}; | ||
use crate::publisher::CaptureControl; | ||
|
||
use super::entry::EventEntry; | ||
use super::{entry::EventEntry, Id, Msg}; | ||
|
||
pub trait Filter<K> | ||
pub trait Filter<K, M> | ||
where | ||
K: Id + CaptureControl, | ||
M: Msg, | ||
{ | ||
/// Return `true` if the entry is allowed to be captured. | ||
fn allow_entry(&self, entry: &impl EventEntry<K>) -> bool; | ||
fn allow_entry(&self, entry: &impl EventEntry<K, M>) -> bool; | ||
} | ||
|
||
#[derive(Default, Debug)] | ||
pub struct DummyFilter<K> | ||
pub struct DummyFilter<K, M> | ||
where | ||
K: Id + CaptureControl, | ||
M: Msg, | ||
{ | ||
v: PhantomData<K>, | ||
v1: PhantomData<K>, | ||
v2: PhantomData<M>, | ||
} | ||
|
||
impl<K> Filter<K> for DummyFilter<K> | ||
impl<K, M> Filter<K, M> for DummyFilter<K, M> | ||
where | ||
K: Id + CaptureControl, | ||
M: Msg, | ||
{ | ||
fn allow_entry(&self, _entry: &impl EventEntry<K>) -> bool { | ||
fn allow_entry(&self, _entry: &impl EventEntry<K, M>) -> bool { | ||
true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.