diff --git a/src/pxar/decoder.rs b/src/pxar/decoder.rs index c8e3b9d3..f3e647bc 100644 --- a/src/pxar/decoder.rs +++ b/src/pxar/decoder.rs @@ -21,17 +21,17 @@ pub struct DirectoryEntry { } // This one needs Read+Seek -pub struct Decoder<'a, R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> { - inner: SequentialDecoder<'a, R, F>, +pub struct Decoder Result<(), Error>> { + inner: SequentialDecoder, root_start: u64, root_end: u64, } const HEADER_SIZE: u64 = std::mem::size_of::() as u64; -impl <'a, R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<'a, R, F> { +impl Result<(), Error>> Decoder { - pub fn new(reader: &'a mut R, callback: F) -> Result { + pub fn new(mut reader: R, callback: F) -> Result { let root_end = reader.seek(SeekFrom::End(0))?; diff --git a/src/pxar/sequential_decoder.rs b/src/pxar/sequential_decoder.rs index e2aba0ef..f3a0643b 100644 --- a/src/pxar/sequential_decoder.rs +++ b/src/pxar/sequential_decoder.rs @@ -33,8 +33,8 @@ use crate::tools::acl; use crate::tools::xattr; // This one need Read, but works without Seek -pub struct SequentialDecoder<'a, R: Read, F: Fn(&Path) -> Result<(), Error>> { - reader: &'a mut R, +pub struct SequentialDecoder Result<(), Error>> { + reader: R, feature_flags: u64, allow_existing_dirs: bool, skip_buffer: Vec, @@ -43,9 +43,9 @@ pub struct SequentialDecoder<'a, R: Read, F: Fn(&Path) -> Result<(), Error>> { const HEADER_SIZE: u64 = std::mem::size_of::() as u64; -impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F> { +impl Result<(), Error>> SequentialDecoder { - pub fn new(reader: &'a mut R, feature_flags: u64, callback: F) -> Self { + pub fn new(reader: R, feature_flags: u64, callback: F) -> Self { let skip_buffer = vec::undefined(64*1024); Self { @@ -61,8 +61,8 @@ impl <'a, R: Read, F: Fn(&Path) -> Result<(), Error>> SequentialDecoder<'a, R, F self.allow_existing_dirs = allow; } - pub (crate) fn get_reader_mut(&mut self) -> & mut R { - self.reader + pub (crate) fn get_reader_mut(&mut self) -> &mut R { + &mut self.reader } pub (crate) fn read_item(&mut self) -> Result {