remove comment from TrieState We could, but it would not give any benefit if we returned (Option<&V>, Option<K>): - If the caller still needs the key, he must clone it before calling next() because he may not get it back - If the caller doesn't need the key, we would not need to return it For types that are not Clone, we're better off wrapping them with the newtype pattern and implementing Clone for that.
1 files changed, 1 insertions(+), 2 deletions(-) M src/trie.rs
M src/trie.rs +1 -2
@@ 2,7 2,6 @@ extern crate sequence_trie; pub use self::sequence_trie::*; -// XXX can we get rid of <K: Clone> by returning ownership from next()? pub struct TrieState<K, V> where K: TrieKey + Clone { trie: SequenceTrie<K, V>, @@ 13,7 12,7 @@ impl<K, V> TrieState<K, V> where K: TrieKey + Clone { pub fn new(trie: SequenceTrie<K, V>) -> Self { Self { - trie: trie, + trie, path: Vec::new() } }