michaelsproul / rust_radix_trie

Fast generic radix trie implemented in Rust
https://docs.rs/radix_trie/
MIT License
184 stars 32 forks source link

Is `get_ancestor_value_mut` a possible method ? #71

Closed alexandre-roulin closed 1 year ago

alexandre-roulin commented 1 year ago

Hey, I have pretty good result from this crate but I need the value to be mutable. Is it possible ? pub fn get_ancestor_value_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V>

michaelsproul commented 1 year ago

Did you close this because you worked around it by using get_ancestor and subtrie_mut?

alexandre-roulin commented 1 year ago

I just use a Mutex inside the value to be able to make it freely mutable. Not really, I use sorting to analyze the network. 192.168.0.0/16 should match all Ip starting with 192.168.x.x. For this analysis, the get_ancestor_value, always gives me (atm) the right value. But the API only gives me access to the non-mutable value, but I think that's defined by the design.