Refactor: Simplify untar with new enum Op

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-12 17:03:39 +10:00
parent b2c34137cc
commit 17fcac7e63
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 33 additions and 29 deletions

View file

@ -225,8 +225,7 @@ where
extract_compressed_from_readable::<DummyVisitor, _>(
ReadableRx::new(&mut rx),
fmt,
&path,
None,
Op::UnpackToPath(&path),
)
})
.await
@ -246,12 +245,7 @@ where
extract_impl(stream, move |mut rx| {
fs::create_dir_all(path.parent().unwrap())?;
extract_compressed_from_readable(
ReadableRx::new(&mut rx),
fmt,
&*path,
Some(&mut visitor),
)?;
extract_compressed_from_readable(ReadableRx::new(&mut rx), fmt, Op::Visit(&mut visitor))?;
Ok(visitor)
})