@@ -81,11 +81,16 @@ impl<T> Map<uint, T> for TrieMap<T> {
8181
8282 /// Visit all values in order
8383 #[ inline( always) ]
84- pure fn each_value ( & self ,
85- f : & fn ( & T ) -> bool ) {
84+ pure fn each_value ( & self , f : & fn ( & T ) -> bool ) {
8685 self . each ( |& ( _, v) | f ( v) )
8786 }
8887
88+ /// Iterate over the map and mutate the contained values
89+ #[ inline( always) ]
90+ fn mutate_values ( & mut self , f : & fn ( & uint , & mut T ) -> bool ) {
91+ self . root . mutate_values ( f) ;
92+ }
93+
8994 /// Return the value corresponding to the key in the map
9095 #[ inline( hint) ]
9196 pure fn find ( & self , key : & uint ) -> Option < & self /T > {
@@ -150,11 +155,6 @@ impl<T> TrieMap<T> {
150155 pure fn each_value_reverse ( & self , f : & fn ( & T ) -> bool ) {
151156 self . each_reverse ( |& ( _, v) | f ( v) )
152157 }
153-
154- /// Iterate over the map and mutate the contained values
155- fn mutate_values ( & mut self , f : & fn ( uint , & mut T ) -> bool ) {
156- self . root . mutate_values ( f) ;
157- }
158158}
159159
160160pub struct TrieSet {
@@ -248,13 +248,13 @@ impl<T> TrieNode<T> {
248248 true
249249 }
250250
251- fn mutate_values ( & mut self , f : & fn ( uint , & mut T ) -> bool ) -> bool {
251+ fn mutate_values ( & mut self , f : & fn ( & uint , & mut T ) -> bool ) -> bool {
252252 for vec:: each_mut( self . children) |child| {
253253 match * child {
254254 Internal ( ref mut x) => if !x. mutate_values ( f) {
255255 return false
256256 } ,
257- External ( k, ref mut v) => if !f ( k, v) { return false } ,
257+ External ( k, ref mut v) => if !f ( & k, v) { return false } ,
258258 Nothing => ( )
259259 }
260260 }
@@ -269,8 +269,8 @@ pure fn chunk(n: uint, idx: uint) -> uint {
269269 ( n >> ( SHIFT * real_idx) ) & MASK
270270}
271271
272- fn insert < T > ( count : & mut uint , child : & mut Child < T > , key : uint ,
273- value : T , idx : uint ) -> bool {
272+ fn insert < T > ( count : & mut uint , child : & mut Child < T > , key : uint , value : T ,
273+ idx : uint ) -> bool {
274274 let mut tmp = Nothing ;
275275 tmp <-> * child;
276276 let mut added = false ;
0 commit comments