io: make writer consume outputter
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 5 Sep 2018 12:00:16 +0000 (14:00 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 5 Sep 2018 12:00:16 +0000 (14:00 +0200)
src/io/byteio.rs
src/test/dec_video.rs

index ca591acf7f10ad94d8564b489ed4b6cf9fd92ed8..e172a325d223e19ff512a6f553b9c4aa083293f1 100644 (file)
@@ -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<u8> {
         Err(ByteIOError::NotImplemented)
index 61577c43e97d171aa2243bf6a5d4c714523ef103..a2cf6e7166d88b1efff18b27e9f3cd94afcd22c7 100644 (file)
@@ -180,8 +180,8 @@ pub fn test_decode_audio(demuxer: &str, name: &str, limit: Option<u64>, 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;