new streams
This commit is contained in:
parent
3963fc50c3
commit
c73be7166f
13 changed files with 748 additions and 174 deletions
|
|
@ -1,12 +1,13 @@
|
|||
use crate::tui::model::LogEntry;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum WipMatcher {
|
||||
Field {
|
||||
name: Option<String>,
|
||||
value: Option<serde_json::Value>,
|
||||
},
|
||||
Specific {
|
||||
path: Option<Vec<usize>>,
|
||||
hash: Option<u64>,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -20,9 +21,7 @@ impl WipMatcher {
|
|||
name: name.clone(),
|
||||
value: value.clone(),
|
||||
}),
|
||||
WipMatcher::Specific { path: Some(path) } => {
|
||||
Some(Matcher::Specific { path: path.clone() })
|
||||
}
|
||||
WipMatcher::Specific { hash } => Some(Matcher::Specific { hash: (*hash)? }),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +33,7 @@ pub enum Matcher {
|
|||
value: serde_json::Value,
|
||||
},
|
||||
Specific {
|
||||
path: Vec<usize>,
|
||||
hash: u64,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +45,7 @@ impl Matcher {
|
|||
.fields
|
||||
.get(name)
|
||||
.is_some_and(|v| v == value),
|
||||
Matcher::Specific { path } => false,
|
||||
Matcher::Specific { hash } => entry.hash() == *hash,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -62,6 +61,16 @@ pub struct Filter {
|
|||
pub kind: FilterKind,
|
||||
}
|
||||
|
||||
impl Filter {
|
||||
pub fn removes(&self, elem: &LogEntry) -> bool {
|
||||
match self.kind {
|
||||
FilterKind::Inline => false,
|
||||
FilterKind::Remove => self.matcher.matches(elem),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct WipFilter {
|
||||
pub matcher: Option<WipMatcher>,
|
||||
pub kind: Option<FilterKind>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue