aboutsummaryrefslogtreecommitdiff
path: root/src/filters.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/filters.rs')
-rw-r--r--src/filters.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/filters.rs b/src/filters.rs
index 6980900..f9db377 100644
--- a/src/filters.rs
+++ b/src/filters.rs
@@ -1,6 +1,6 @@
use evtclib::{AgentName, Log};
-use super::{LogResult, Opt};
+use super::{SearchField, FightOutcome, LogResult, Opt};
/// Do filtering based on the character or account name.
pub fn filter_name(log: &Log, opt: &Opt) -> bool {
@@ -11,8 +11,8 @@ pub fn filter_name(log: &Log, opt: &Opt) -> bool {
character_name,
..
} => {
- if (opt.field.search_account() && opt.expression.is_match(account_name))
- || (opt.field.search_character() && opt.expression.is_match(character_name))
+ if (opt.field.contains(&SearchField::Account) && opt.expression.is_match(account_name))
+ || (opt.field.contains(&SearchField::Character) && opt.expression.is_match(character_name))
{
return true;
}
@@ -25,11 +25,7 @@ pub fn filter_name(log: &Log, opt: &Opt) -> bool {
/// Do filtering based on the fight outcome.
pub fn filter_outcome(result: &LogResult, opt: &Opt) -> bool {
- match opt.outcome {
- Some(o) if o == result.outcome => true,
- None => true,
- _ => false,
- }
+ opt.outcome.contains(&result.outcome)
}
/// Do filtering based on encounter time.