diff options
Diffstat (limited to 'src/output/formats.rs')
-rw-r--r-- | src/output/formats.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/output/formats.rs b/src/output/formats.rs index b697401..a608eab 100644 --- a/src/output/formats.rs +++ b/src/output/formats.rs @@ -1,8 +1,8 @@ //! A crate defining different output formats for search results. use std::fmt::Write; -use super::{LogResult, FightOutcome}; use super::super::guilds; +use super::{FightOutcome, LogResult}; /// An output format pub trait Format: Sync + Send { @@ -10,14 +10,12 @@ pub trait Format: Sync + Send { fn format_result(&self, item: &LogResult) -> String; } - /// The human readable, colored format. #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] pub struct HumanReadable { pub show_guilds: bool, } - impl Format for HumanReadable { fn format_result(&self, item: &LogResult) -> String { use colored::Colorize; @@ -36,7 +34,8 @@ impl Format for HumanReadable { "Boss".green(), item.boss_name, outcome, - ).unwrap(); + ) + .unwrap(); for player in &item.players { write!( result, @@ -45,7 +44,8 @@ impl Format for HumanReadable { player.account_name.yellow(), player.character_name.cyan(), player.profession, - ).unwrap(); + ) + .unwrap(); if self.show_guilds { let guild = player.guild_id.as_ref().and_then(|id| guilds::lookup(id)); if let Some(guild) = guild { @@ -54,7 +54,8 @@ impl Format for HumanReadable { " [{}] {}", guild.tag().magenta(), guild.name().magenta(), - ).unwrap(); + ) + .unwrap(); } } writeln!(result).unwrap(); @@ -63,12 +64,10 @@ impl Format for HumanReadable { } } - /// A format which outputs only the file-name #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] pub struct FileOnly; - impl Format for FileOnly { fn format_result(&self, item: &LogResult) -> String { let filename = item.log_file.to_string_lossy(); |