src/pxar/sequential_decoder.rs: remove callback from new()
And use an extra functzion set_callback() to configure that. Also rewrite pxar/fuse.rs and implement a generic Session (will get further cleanups with next patches).
This commit is contained in:
@ -27,8 +27,8 @@ pub struct DirectoryEntry {
|
||||
}
|
||||
|
||||
// This one needs Read+Seek
|
||||
pub struct Decoder<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> {
|
||||
inner: SequentialDecoder<R, F>,
|
||||
pub struct Decoder<R: Read + Seek> {
|
||||
inner: SequentialDecoder<R>,
|
||||
root_start: u64,
|
||||
root_end: u64,
|
||||
}
|
||||
@ -36,15 +36,16 @@ pub struct Decoder<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> {
|
||||
const HEADER_SIZE: u64 = std::mem::size_of::<PxarHeader>() as u64;
|
||||
const GOODBYE_ITEM_SIZE: u64 = std::mem::size_of::<PxarGoodbyeItem>() as u64;
|
||||
|
||||
impl<R: Read + Seek, F: Fn(&Path) -> Result<(), Error>> Decoder<R, F> {
|
||||
pub fn new(mut reader: R, callback: F) -> Result<Self, Error> {
|
||||
impl<R: Read + Seek> Decoder<R> {
|
||||
pub fn new(mut reader: R) -> Result<Self, Error> {
|
||||
let root_end = reader.seek(SeekFrom::End(0))?;
|
||||
let inner = SequentialDecoder::new(reader, super::flags::DEFAULT);
|
||||
|
||||
Ok(Self { inner, root_start: 0, root_end })
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
inner: SequentialDecoder::new(reader, super::flags::DEFAULT, callback),
|
||||
root_start: 0,
|
||||
root_end,
|
||||
})
|
||||
pub fn set_callback<F: Fn(&Path) -> Result<(), Error> + 'static>(&mut self, callback: F ) {
|
||||
self.inner.set_callback(callback);
|
||||
}
|
||||
|
||||
pub fn root(&mut self) -> Result<DirectoryEntry, Error> {
|
||||
|
Reference in New Issue
Block a user