diff options
Diffstat (limited to 'src/filters/player.rs')
-rw-r--r-- | src/filters/player.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/filters/player.rs b/src/filters/player.rs index 4daeb22..7258bd7 100644 --- a/src/filters/player.rs +++ b/src/filters/player.rs @@ -8,8 +8,10 @@ use super::{ Filter, Inclusion, }; +use std::convert::TryFrom; + use evtclib::raw::parser::PartialEvtc; -use evtclib::{Agent, AgentName}; +use evtclib::{Agent, AgentKind}; use regex::Regex; @@ -31,7 +33,7 @@ impl Filter<PartialEvtc, LogResult> for AllPlayers { continue; } - let agent = Agent::from_raw(agent); + let agent = Agent::try_from(agent); if let Ok(agent) = agent { result = result & self.0.filter_early(&agent); } else { @@ -72,15 +74,10 @@ impl Filter<Agent, Player> for NameFilter { return Inclusion::Unknown; } - if let AgentName::Player { - ref account_name, - ref character_name, - .. - } = agent.name() - { + if let AgentKind::Player(ref player) = agent.kind() { let field = match self.0 { - SearchField::Account => account_name, - SearchField::Character => character_name, + SearchField::Account => player.account_name(), + SearchField::Character => player.character_name(), _ => unreachable!("We already checked for Guild earlier"), }; self.1.is_match(field).into() |