Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing a closure for ArchiveIterator::filter #115

Merged
merged 1 commit into from
May 26, 2023
Merged

Conversation

otavio
Copy link
Member

@otavio otavio commented May 26, 2023

Fixes: #114.
Signed-off-by: Otavio Salvador [email protected]

@github-actions
Copy link

github-actions bot commented May 26, 2023

Pull Request Test Coverage Report for Build 5093390276

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 84.938%

Totals Coverage Status
Change from base Build 5052026356: 0.0%
Covered Lines: 344
Relevant Lines: 405

💛 - Coveralls

@keysym
Copy link

keysym commented May 26, 2023

In testing, maybe the filter should unwrap the filename?!

diff --git a/tests/integration_test.rs b/tests/integration_test.rs
index 55eb140..bacc143 100644
--- a/tests/integration_test.rs
+++ b/tests/integration_test.rs
@@ -731,11 +731,11 @@ fn decode_chinese_zip() {
 #[test]
 fn iterate_archive_with_filter_name() {
     let source = std::fs::File::open("tests/fixtures/tree.tar").unwrap();
-    let expected_name = Some(OsStr::new("leaf"));
+    let expected_name = OsStr::new("leaf");
 
     let mut entries = Vec::new();
     for content in ArchiveIteratorBuilder::new(source)
-        .filter(move |name, _stat| Path::new(name).file_name() == expected_name)
+        .filter(move |name, _stat| Path::new(name).file_name().unwrap() == expected_name)
         .build()
         .unwrap()
     {

But the PR looks perfect!
This allows my use case and doesn't break the old behavior.

@otavio
Copy link
Member Author

otavio commented May 26, 2023

I prefer to avoid unwrap, but I reworked it even more.

@otavio otavio merged commit 27c2dde into master May 26, 2023
@otavio otavio deleted the fix/114 branch May 26, 2023 17:23
@coveralls
Copy link

coveralls commented Jun 8, 2024

Pull Request Test Coverage Report for Build 5093390276

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 84.938%

Totals Coverage Status
Change from base Build 5052026356: 0.0%
Covered Lines: 344
Relevant Lines: 405

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 10, 2024

Pull Request Test Coverage Report for Build 5091551968

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-1.0%) to 83.951%

Files with Coverage Reduction New Missed Lines %
../../../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-channel-0.3.28/src/mpsc/mod.rs 1 90.34%
../../../.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-channel-0.3.28/src/mpsc/sink_impl.rs 3 76.92%
Totals Coverage Status
Change from base Build 5052026356: -1.0%
Covered Lines: 340
Relevant Lines: 405

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Could EntryFilterCallback be a Fn trait to allow closures?
3 participants