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

[draft] Support map::Trie#children #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

j6k4m8
Copy link

@j6k4m8 j6k4m8 commented Aug 20, 2024

Hi @shanecelis — based on #35 I've drafted the following implementation.

I'm a rust noob so would be happy to take feedback on this; in particular, I think my trait constraints are correct, but could definitely use some extra eyes on that!

The traversal code I copied from longest_prefix though it's possible we should instead support an exact match only..?

This code also implements children_values and children_labels, where children_labels can accept a boolean terminals_only flag so that only labels for terminal nodes are returned (i.e., direct descendants) instead of for subtries as well.

@j6k4m8
Copy link
Author

j6k4m8 commented Aug 21, 2024

Wondering now about the best way to support access to the following;

labels values
children
children that are terminals
children that are non-terminals

Should that just be four different functions..? (Five including children that returns a ChildNodeIter) Or is there some more elegant pattern we could use...

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

Successfully merging this pull request may close these issues.

1 participant