From d4a24eef7fd410c147de201d776089e0601317d5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 12 Jun 2020 00:48:18 +0200 Subject: initial work on comparison based filters This enables filters such as -time > 2020-01-01 -time < 2020-02-03 ... for time and duration, and later possibly also for more things (such as a COUNT(...) construct). This work tries to integrate them into the existing filter system as seamless as possible, by providing a Comparator which implements LogFilter. The "type checking" is done at parse time, so nonsensical comparisons like -time > 12s flat out give a parse error. This however might be changed to a more dynamic system with run-time type checking, in which case we could do away with the type parameter on Producer and simply work with a generic Value. The comparator would then return an error if two non-identical types would be compared. Note that the system does not support arithmetic expressions, only simple comparisons to constant values. --- src/filters/mod.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/filters/mod.rs') diff --git a/src/filters/mod.rs b/src/filters/mod.rs index 162b6f8..e966851 100644 --- a/src/filters/mod.rs +++ b/src/filters/mod.rs @@ -5,6 +5,7 @@ use num_traits::FromPrimitive as _; pub mod log; pub mod player; +pub mod values; /// Early filtering result. /// -- cgit v1.2.3 From 918f1e4eeab94ee8850aefd7c17b48ea2adcd6d2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 12 Jun 2020 16:04:17 +0200 Subject: fix up doc comments and tests --- src/filters/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/filters/mod.rs') diff --git a/src/filters/mod.rs b/src/filters/mod.rs index e966851..7ab0d42 100644 --- a/src/filters/mod.rs +++ b/src/filters/mod.rs @@ -63,8 +63,8 @@ pub trait Filter: Send + Sync + fmt::Debug { /// Determine early (before processing all events) whether the log stands a chance to be /// included. /// - /// Note that you can return [Inclusion::Unkown] if this filter cannot determine yet a definite - /// answer. + /// Note that you can return [Inclusion::Unknown] if this filter cannot determine yet a + /// definite answer. fn filter_early(&self, _: &Early) -> Inclusion { Inclusion::Unknown } -- cgit v1.2.3