Rewrite AsyncExtracter: Extract fmt logic as callback fn

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-11 20:10:46 +10:00
parent d1033758a7
commit 7b52eaad5b
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
2 changed files with 128 additions and 108 deletions

View file

@ -56,8 +56,8 @@ fn untar<Filter: FnMut(&Path) -> bool>(
/// and only extract ones which filter returns `true`.
/// Note that this is a best-effort and it only works when `fmt`
/// is not `PkgFmt::Bin` or `PkgFmt::Zip`.
pub(crate) fn extract_compressed_from_readable<Filter: FnMut(&Path) -> bool>(
dat: impl BufRead,
pub(crate) fn extract_compressed_from_readable<Filter: FnMut(&Path) -> bool, R: BufRead>(
dat: R,
fmt: PkgFmt,
path: &Path,
filter: Option<Filter>,