diff options
author | Till Höppner | 2016-03-02 12:57:36 +0100 |
---|---|---|
committer | Till Höppner | 2016-03-02 12:57:36 +0100 |
commit | a4db0628a0377b39be02f0e83832b0c3527933e1 (patch) | |
tree | 375e33b2942b6374e352b554d7202664812ddf2f /formats/energymech/src/lib.rs | |
parent | 52d4c29f5bce85abadeb9fd394f55caf488b37f3 (diff) | |
download | ilc-a4db0628a0377b39be02f0e83832b0c3527933e1.tar.gz ilc-a4db0628a0377b39be02f0e83832b0c3527933e1.tar.xz ilc-a4db0628a0377b39be02f0e83832b0c3527933e1.zip |
Diffstat (limited to 'formats/energymech/src/lib.rs')
-rw-r--r-- | formats/energymech/src/lib.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/formats/energymech/src/lib.rs b/formats/energymech/src/lib.rs index e0863e7..ed687f0 100644 --- a/formats/energymech/src/lib.rs +++ b/formats/energymech/src/lib.rs @@ -29,6 +29,7 @@ use log::LogLevel::Info; use chrono::*; +#[derive(Copy, Clone)] pub struct Energymech; static TIME_FORMAT: &'static str = "%H:%M:%S"; @@ -219,12 +220,15 @@ impl<'a> Iterator for Iter<'a> { channel: self.context.channel.clone().map(Into::into), })); } + if option_env!("FUSE").is_some() { + panic!("Shouldn't reach here, this is a bug!") + } } } } impl Decode for Energymech { - fn decode<'a>(&'a mut self, + fn decode<'a>(&'a self, context: &'a Context, input: &'a mut BufRead) -> Box<Iterator<Item = ilc_base::Result<Event<'a>>> + 'a> { @@ -250,6 +254,13 @@ impl Encode for Energymech { from, content)) } + &Event { ty: Type::Notice { ref from, ref content }, ref time, .. } => { + try!(writeln!(&mut output, + "[{}] -{}- {}", + time.with_format(&context.timezone, TIME_FORMAT), + from, + content)) + } &Event { ty: Type::Action { ref from, ref content }, ref time, .. } => { try!(writeln!(&mut output, "[{}] * {} {}", @@ -302,7 +313,12 @@ impl Encode for Energymech { nick.as_ref().expect("Nick not present, but required."), new_topic)) } - _ => (), + _ => { + if option_env!("FUSE").is_some() { + panic!("Shouldn't reach here, this is a bug!") + } + () + } } Ok(()) } |