pxar: Refactor SequentialDecoder to store the callback function within the struct

Reduces the number of arguments for the function calls within the decoder.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner
2019-07-04 14:03:20 +02:00
committed by Dietmar Maurer
parent b46c3fad03
commit 7dcbe051e9
5 changed files with 34 additions and 44 deletions

View File

@ -649,14 +649,14 @@ fn restore(
let mut reader = BufferedDynamicReader::new(index, chunk_reader);
let feature_flags = pxar::CA_FORMAT_DEFAULT;
let mut decoder = pxar::SequentialDecoder::new(&mut reader, feature_flags);
decoder.restore(Path::new(target), & |path| {
let mut decoder = pxar::SequentialDecoder::new(&mut reader, feature_flags, |path| {
if verbose {
println!("{:?}", path);
}
Ok(())
})?;
});
decoder.restore(Path::new(target))?;
Ok(Value::Null)
}