src/pxar/decoder.rs: require Send
This commit is contained in:
parent
bb084b9c91
commit
b9799012cf
|
@ -33,7 +33,7 @@ impl <R: Read + Seek> ReadSeek for R {}
|
|||
|
||||
// This one needs Read+Seek
|
||||
pub struct Decoder {
|
||||
inner: SequentialDecoder<Box<dyn ReadSeek>>,
|
||||
inner: SequentialDecoder<Box<dyn ReadSeek + Send>>,
|
||||
root_start: u64,
|
||||
root_end: u64,
|
||||
}
|
||||
|
@ -42,15 +42,15 @@ const HEADER_SIZE: u64 = std::mem::size_of::<PxarHeader>() as u64;
|
|||
const GOODBYE_ITEM_SIZE: u64 = std::mem::size_of::<PxarGoodbyeItem>() as u64;
|
||||
|
||||
impl Decoder {
|
||||
pub fn new<R: Read + Seek + 'static>(mut reader: R) -> Result<Self, Error> {
|
||||
pub fn new<R: Read + Seek + Send + 'static>(mut reader: R) -> Result<Self, Error> {
|
||||
let root_end = reader.seek(SeekFrom::End(0))?;
|
||||
let boxed_reader: Box<dyn ReadSeek + 'static> = Box::new(reader);
|
||||
let boxed_reader: Box<dyn ReadSeek + 'static + Send> = Box::new(reader);
|
||||
let inner = SequentialDecoder::new(boxed_reader, super::flags::DEFAULT);
|
||||
|
||||
Ok(Self { inner, root_start: 0, root_end })
|
||||
}
|
||||
|
||||
pub fn set_callback<F: Fn(&Path) -> Result<(), Error> + 'static>(&mut self, callback: F ) {
|
||||
pub fn set_callback<F: Fn(&Path) -> Result<(), Error> + Send + 'static>(&mut self, callback: F ) {
|
||||
self.inner.set_callback(callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ pub struct SequentialDecoder<R: Read> {
|
|||
feature_flags: u64,
|
||||
allow_existing_dirs: bool,
|
||||
skip_buffer: Vec<u8>,
|
||||
callback: Option<Box<dyn Fn(&Path) -> Result<(), Error>>>,
|
||||
callback: Option<Box<dyn Fn(&Path) -> Result<(), Error> + Send>>,
|
||||
}
|
||||
|
||||
const HEADER_SIZE: u64 = std::mem::size_of::<PxarHeader>() as u64;
|
||||
|
@ -57,7 +57,7 @@ impl<R: Read> SequentialDecoder<R> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_callback<F: Fn(&Path) -> Result<(), Error> + 'static>(&mut self, callback: F ) {
|
||||
pub fn set_callback<F: Fn(&Path) -> Result<(), Error> + Send + 'static>(&mut self, callback: F ) {
|
||||
self.callback = Some(Box::new(callback));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue