You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A have a use case where I have a set of 1 or more globs, and want to know if all of them match, rather than if any of them match.
I can of course use a Vec<Glob> and do something like globs.iter().all(|g| g.is_match(path)), but it sounds like using a GlobSet may be more efficient, since it can use a single pass.
I think I can accomplish this with glob_set.matches(path).len() == glob_set.len(), but then it has to allocate a Vec, and then I just throw it away, because I only care about the length.
Possible ways this could be improved are:
Add a matches_all method that returns true if all globs match (fwiw, I'd also like that on RegexSet)
Return an iterator similar to how RegexSet.matches returns an iterator, so it can be counted instead of storing in a Vec.
The text was updated successfully, but these errors were encountered:
tmccombs
added a commit
to tmccombs/ripgrep
that referenced
this issue
Sep 19, 2024
A have a use case where I have a set of 1 or more globs, and want to know if all of them match, rather than if any of them match.
I can of course use a
Vec<Glob>
and do something likeglobs.iter().all(|g| g.is_match(path))
, but it sounds like using aGlobSet
may be more efficient, since it can use a single pass.I think I can accomplish this with
glob_set.matches(path).len() == glob_set.len()
, but then it has to allocate aVec
, and then I just throw it away, because I only care about the length.Possible ways this could be improved are:
matches_all
method that returns true if all globs match (fwiw, I'd also like that onRegexSet
)RegexSet.matches
returns an iterator, so it can be counted instead of storing in a Vec.The text was updated successfully, but these errors were encountered: