From: Kostya Shishkov Date: Wed, 5 Sep 2018 12:00:16 +0000 (+0200) Subject: io: make writer consume outputter X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=5eb3cc6035c6c247ffd7e0ac2e3f0f49f1e2ee7b;p=nihav.git io: make writer consume outputter --- diff --git a/src/io/byteio.rs b/src/io/byteio.rs index ca591ac..e172a32 100644 --- a/src/io/byteio.rs +++ b/src/io/byteio.rs @@ -370,8 +370,8 @@ pub struct MemoryWriter<'a> { pos: usize, } -pub struct FileWriter<'a> { - file: &'a File, +pub struct FileWriter { + file: File, } impl<'a> ByteWriter<'a> { @@ -519,13 +519,13 @@ impl<'a> ByteIO for MemoryWriter<'a> { } } -impl<'a> FileWriter<'a> { - pub fn new_write(file: &'a mut File) -> Self { +impl FileWriter { + pub fn new_write(file: File) -> Self { FileWriter { file: file } } } -impl<'a> ByteIO for FileWriter<'a> { +impl ByteIO for FileWriter { #[allow(unused_variables)] fn read_byte(&mut self) -> ByteIOResult { Err(ByteIOError::NotImplemented) diff --git a/src/test/dec_video.rs b/src/test/dec_video.rs index 61577c4..a2cf6e7 100644 --- a/src/test/dec_video.rs +++ b/src/test/dec_video.rs @@ -180,8 +180,8 @@ pub fn test_decode_audio(demuxer: &str, name: &str, limit: Option, audio_pf } let name = format!("assets/{}out.wav", audio_pfx); - let mut file = File::create(name).unwrap(); - let mut fw = FileWriter::new_write(&mut file); + let file = File::create(name).unwrap(); + let mut fw = FileWriter::new_write(file); let mut wr = ByteWriter::new(&mut fw); let mut wwr = WavWriter::new(&mut wr); let mut wrote_header = false;