From 331d6b1762d1d9431b210fc98a495d56ad7a1cd1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 13 May 2020 12:52:13 +0200 Subject: clean up SearchField related code With the addition of our own parser, we no longer need the FromStr implementation for SearchField. Furthermore, it is now only used in player::NameFilter, so the definition has been moved there. The import in the grammar was unused as well, so it has been removed. --- src/filters/player.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/filters') diff --git a/src/filters/player.rs b/src/filters/player.rs index 2b14eb0..d3185e0 100644 --- a/src/filters/player.rs +++ b/src/filters/player.rs @@ -3,7 +3,7 @@ //! Additionally, it provides methods to lift a player filter to a log filter with [`any`][any] and //! [`all`][all]. use super::{ - super::{guilds, playerclass::PlayerClass, EarlyLogResult, LogResult, Player, SearchField}, + super::{guilds, playerclass::PlayerClass, EarlyLogResult, LogResult, Player}, log::LogFilter, Filter, Inclusion, }; @@ -61,6 +61,17 @@ pub fn any(player_filter: Box) -> Box { !all(!player_filter) } +/// A flag indicating which fields should be searched. +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum SearchField { + /// Only search the account name. + Account, + /// Only search the character name. + Character, + /// Only search the guild name or tag. + Guild, +} + /// Filter that filters players according to their name. /// /// The given SearchField determines in which field something should be searched. -- cgit v1.2.3