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

find_postfixes_with_current proposal #3

Open
allevo opened this issue Dec 9, 2024 · 0 comments
Open

find_postfixes_with_current proposal #3

allevo opened this issue Dec 9, 2024 · 0 comments

Comments

@allevo
Copy link

allevo commented Dec 9, 2024

Hi!
I'd like to add a new feature to have back if there's an exact match and the postfix in one call.
This is useful to distinguish what match exaclty from what don't.
Something like

    pub fn find_postfixes_with_current<I: Iterator<Item = K>>(&self, prefix: I) -> (Option<&V>, Vec<&V>) {
        let mut postfixes = Vec::new();
        let mut exact = None;
        if let Some(node) = self.find_node(prefix) {
            exact = node.value.as_ref();
            for (_, child) in &node.children {
                self.collect_values(child, &mut postfixes);
            }
        }
        (exact, postfixes)
    }

Anyway, before sending a PR, I would like to know if:

  • you are interested in this feature
  • you like the interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant