Skip to content

Feature: Add id to Glob to allow GlobSet identifying/reporting which one matched #3081

@reneleonhardt

Description

@reneleonhardt

Describe your feature request

GlobSet is very useful, but at the moment it can't report which specific Glob matched, it only reports true/false after iterating patterns.

Current function:

pub fn is_match_candidate(&self, path: &Candidate<'_>) -> bool {

New function:

pub fn get_match_id(&self, path: &Candidate<'_>) -> Option<String> {
pub struct Glob {
    id: String, // Identifier
    glob: String,
    re: String,
    opts: GlobOptions,
    tokens: Tokens,
}

This would allow to process even hundreds of Globs (maybe even in parallel with futures-concurrency) while still being able to identify which exact pattern matched and process a corresponding mapping accordingly (i.e. ".gitignore discarded Cargo.lock").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions