]> git.nihav.org Git - nihav.git/blobdiff - src/io/byteio.rs
byteio: update syntax
[nihav.git] / src / io / byteio.rs
index ca591acf7f10ad94d8564b489ed4b6cf9fd92ed8..966169cdefa00756767c79a500cd64ef70499064 100644 (file)
@@ -48,7 +48,7 @@ pub struct FileReader<'a> {
 macro_rules! read_int {
     ($s: ident, $inttype: ty, $size: expr, $which: ident) => ({
         let mut buf = [0; $size];
-        try!($s.read_buf(&mut buf));
+        $s.read_buf(&mut buf)?;
         unsafe {
             Ok((*(buf.as_ptr() as *const $inttype)).$which())
         }
@@ -58,7 +58,7 @@ macro_rules! read_int {
 macro_rules! peek_int {
     ($s: ident, $inttype: ty, $size: expr, $which: ident) => ({
         let mut buf = [0; $size];
-        try!($s.peek_buf(&mut buf));
+        $s.peek_buf(&mut buf)?;
         unsafe {
             Ok((*(buf.as_ptr() as *const $inttype)).$which())
         }
@@ -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)