michaelsproul / rust_radix_trie

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

Feature borrow get #30

Closed roblabla closed 8 years ago

roblabla commented 8 years ago

Use std::borrow::Borrow for all the methods that use &K.

The feature itself is done, I'm still writing some tests though.

Fixes #13

michaelsproul commented 8 years ago

Looks really nice! The String/&str tests are great, we don't ever want to lose that feature! 👌

michaelsproul commented 8 years ago

Let me know when you feel this is sufficiently tested, and I'll merge it.

It'd be great if you could squash the tiny fixup commits too

roblabla commented 8 years ago

Yup. I was wondering, is there a good way to compare subtries ? Maybe we should implement PartialEq on SubTries ? Cuz the problem is, I'd like to make sure that, for instance, trie.subtrie("/boot").unwrap() == trie.subtrie(&"/boot").unwrap() (to make sure we don't treat those differently, just in case. Might be over-testing but... shrug).

Anyhow, would it even make sense to implement comparison for subtries ?

michaelsproul commented 8 years ago

Sorry it has taken me a while to reply, I think PartialEq for subtries would be fine, just check that the prefix is the same and that iterators over the keys and values return the same thing.

michaelsproul commented 8 years ago

I'm inclined to merge this. I'm happy to add a few more tests myself. Sound good?

roblabla commented 8 years ago

Sounds good :D