diff options
author | Till Hoeppner | 2015-06-09 00:18:31 +0200 |
---|---|---|
committer | Till Hoeppner | 2015-06-09 00:18:31 +0200 |
commit | 9c63c4b89ea0fd889f7f0fd1da71684511e6620e (patch) | |
tree | b50c0598f3aae17f2ab6e8ffad9ef0ba21d6838f /src/format/binary.rs | |
parent | cd182daf35eae3739511f3751843ad01f0d489b3 (diff) | |
download | ilc-9c63c4b89ea0fd889f7f0fd1da71684511e6620e.tar.gz ilc-9c63c4b89ea0fd889f7f0fd1da71684511e6620e.tar.xz ilc-9c63c4b89ea0fd889f7f0fd1da71684511e6620e.zip |
Add basic frequency counter binary
Diffstat (limited to 'src/format/binary.rs')
-rw-r--r-- | src/format/binary.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/format/binary.rs b/src/format/binary.rs index aae760c..f7efd7d 100644 --- a/src/format/binary.rs +++ b/src/format/binary.rs @@ -1,6 +1,5 @@ -use std::io::{ self, BufRead, Write }; -use std::borrow::ToOwned; -use std::iter::{ Iterator }; +use std::io::{ BufRead, Write }; +use std::iter::Iterator; use log::Event; use format::{ Encode, Decode }; @@ -10,19 +9,21 @@ use bincode::{ self, SizeLimit }; pub struct Binary; pub struct Iter<R> where R: BufRead { - input: R, + input: R } impl<R> Iterator for Iter<R> where R: BufRead { type Item = ::Result<Event>; fn next(&mut self) -> Option<::Result<Event>> { - Some(bincode::decode_from(&mut self.input, SizeLimit::Infinite).map_err(|_| ::IlcError::BincodeDecode)) + Some(bincode::decode_from::<R, Event>(&mut self.input, SizeLimit::Infinite) + .map_err(|_| ::IlcError::BincodeDecode)) } } impl<W> Encode<W> for Binary where W: Write { fn encode(&self, mut output: W, event: &Event) -> ::Result<()> { - bincode::encode_into(event, &mut output, SizeLimit::Infinite).map_err(|_| ::IlcError::BincodeEncode) + bincode::encode_into(event, &mut output, SizeLimit::Infinite) + .map_err(|_| ::IlcError::BincodeEncode) } } |