diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/output/aggregators.rs | 2 | ||||
| -rw-r--r-- | src/output/formats.rs | 15 | ||||
| -rw-r--r-- | src/output/mod.rs | 2 | 
3 files changed, 8 insertions, 11 deletions
| diff --git a/src/output/aggregators.rs b/src/output/aggregators.rs index 5d0429c..1b04af3 100644 --- a/src/output/aggregators.rs +++ b/src/output/aggregators.rs @@ -15,12 +15,10 @@ pub trait Aggregator: Sync {      fn finish(self, format: &dyn Format, stream: &mut dyn Write);  } -  /// An aggregator that just pushes through each item to the output stream without any sorting or  /// whatsoever.  pub struct WriteThrough; -  impl Aggregator for WriteThrough {      fn push_item(&self, item: &LogResult, format: &dyn Format, stream: &mut dyn Write) {          let text = format.format_result(item); 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(); diff --git a/src/output/mod.rs b/src/output/mod.rs index aadcbf9..0fd92d9 100644 --- a/src/output/mod.rs +++ b/src/output/mod.rs @@ -2,8 +2,8 @@ use super::{FightOutcome, LogResult, Opt};  use std::io; -pub mod formats;  pub mod aggregators; +pub mod formats;  pub mod pipeline;  pub use self::pipeline::Pipeline; | 
