patricia_tree icon indicating copy to clipboard operation
patricia_tree copied to clipboard

Cannot use `common_prefix` functions to get mutable version

Open allada opened this issue 1 year ago • 2 comments

First, thanks for this library!

I'm looking at a trie/tree library that can quickly give me entries in the tree that match a prefix. This library appears to do this with common_prefix_values() and common_prefixes().

The problem is that when we are using the map it is mutable and we need to publish a value out of the map using a mutable reference, but there's no api for this.

Sadly looking at the code it looks like all the CommonPrefixesIter code paths will need a duplicate mutable version of it (but maybe some templating might work).

allada avatar Aug 27 '24 16:08 allada

The above comment asking you to download a file is malware to steal your account; do not under any circumstances download or run it. The post needs to be removed. If you have attempted to run it please have your system cleaned and your account secured immediately.

caineblood avatar Aug 27 '24 16:08 caineblood

Adding mutable versions of common_prefix_values() and common_prefixes() sounds like a good idea. Would you be interested in implementing these methods? (or, I can work on them when I have time.)

all the CommonPrefixesIter code paths will need a duplicate mutable version of it

Yes. The duplication is not ideal, but acceptable I think.

sile avatar Aug 27 '24 21:08 sile