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:
Dietmar Maurer
2019-11-26 09:56:48 +01:00
parent 49fddd985c
commit f701d0335e
7 changed files with 305 additions and 300 deletions

View File

@ -26,7 +26,7 @@ fn dump_archive_from_reader<R: std::io::Read>(
feature_flags: u64,
verbose: bool,
) -> Result<(), Error> {
let mut decoder = pxar::SequentialDecoder::new(reader, feature_flags, |_| Ok(()));
let mut decoder = pxar::SequentialDecoder::new(reader, feature_flags);
let stdout = std::io::stdout();
let mut out = stdout.lock();
@ -70,7 +70,8 @@ fn extract_archive_from_reader<R: std::io::Read>(
verbose: bool,
pattern: Option<Vec<pxar::MatchPattern>>
) -> Result<(), Error> {
let mut decoder = pxar::SequentialDecoder::new(reader, feature_flags, |path| {
let mut decoder = pxar::SequentialDecoder::new(reader, feature_flags);
decoder.set_callback(move |path| {
if verbose {
println!("{:?}", path);
}