@@ -616,7 +616,7 @@ impl<K, V> TreeMap<K, V> {
616
616
/// ```
617
617
#[ inline]
618
618
#[ experimental = "likely to be renamed, may be removed" ]
619
- pub fn find_with ( & self , f: | & K | -> Ordering ) -> Option < & V > {
619
+ pub fn find_with < F > ( & self , f : F ) -> Option < & V > where F : FnMut ( & K ) -> Ordering {
620
620
tree_find_with ( & self . root , f)
621
621
}
622
622
@@ -641,7 +641,9 @@ impl<K, V> TreeMap<K, V> {
641
641
/// ```
642
642
#[ inline]
643
643
#[ experimental = "likely to be renamed, may be removed" ]
644
- pub fn find_with_mut < ' a > ( & ' a mut self , f: |& K | -> Ordering ) -> Option < & ' a mut V > {
644
+ pub fn find_with_mut < ' a , F > ( & ' a mut self , f : F ) -> Option < & ' a mut V > where
645
+ F : FnMut ( & K ) -> Ordering
646
+ {
645
647
tree_find_with_mut ( & mut self . root , f)
646
648
}
647
649
}
@@ -1129,8 +1131,12 @@ fn split<K: Ord, V>(node: &mut Box<TreeNode<K, V>>) {
1129
1131
// Next 2 functions have the same convention: comparator gets
1130
1132
// at input current key and returns search_key cmp cur_key
1131
1133
// (i.e. search_key.cmp(&cur_key))
1132
- fn tree_find_with < ' r , K , V > ( node : & ' r Option < Box < TreeNode < K , V > > > ,
1133
- f: |& K | -> Ordering ) -> Option < & ' r V > {
1134
+ fn tree_find_with < ' r , K , V , F > (
1135
+ node : & ' r Option < Box < TreeNode < K , V > > > ,
1136
+ mut f : F ,
1137
+ ) -> Option < & ' r V > where
1138
+ F : FnMut ( & K ) -> Ordering ,
1139
+ {
1134
1140
let mut current: & ' r Option < Box < TreeNode < K , V > > > = node;
1135
1141
loop {
1136
1142
match * current {
@@ -1147,8 +1153,12 @@ fn tree_find_with<'r, K, V>(node: &'r Option<Box<TreeNode<K, V>>>,
1147
1153
}
1148
1154
1149
1155
// See comments above tree_find_with
1150
- fn tree_find_with_mut < ' r , K , V > ( node : & ' r mut Option < Box < TreeNode < K , V > > > ,
1151
- f: |& K | -> Ordering ) -> Option < & ' r mut V > {
1156
+ fn tree_find_with_mut < ' r , K , V , F > (
1157
+ node : & ' r mut Option < Box < TreeNode < K , V > > > ,
1158
+ mut f : F ,
1159
+ ) -> Option < & ' r mut V > where
1160
+ F : FnMut ( & K ) -> Ordering ,
1161
+ {
1152
1162
1153
1163
let mut current = node;
1154
1164
loop {
0 commit comments