@@ -72,6 +72,7 @@ the standard library and functions that are included in the results list:
7272| [ ` stdout, [u8] ` ] [ stdoutu8 ] | ` Stdout::write ` |
7373| [ ` any -> ! ` ] [ ] | ` panic::panic_any ` |
7474| [ ` vec::intoiter<T> -> [T] ` ] [ iterasslice ] | ` IntoIter::as_slice ` and ` IntoIter::next_chunk ` |
75+ | [ ` iterator<T>, fnmut -> T ` ] [ iterreduce ] | ` Iterator::reduce ` and ` Iterator::find ` |
7576
7677[ `usize -> vec` ] : ../../std/vec/struct.Vec.html?search=usize%20-%3E%20vec&filter-crate=std
7778[ `vec, vec -> bool` ] : ../../std/vec/struct.Vec.html?search=vec,%20vec%20-%3E%20bool&filter-crate=std
@@ -81,6 +82,7 @@ the standard library and functions that are included in the results list:
8182[ `any -> !` ] : ../../std/vec/struct.Vec.html?search=any%20-%3E%20!&filter-crate=std
8283[ stdoutu8 ] : ../../std/vec/struct.Vec.html?search=stdout%2C%20[u8]&filter-crate=std
8384[ iterasslice ] : ../../std/vec/struct.Vec.html?search=vec%3A%3Aintoiter<T>%20->%20[T]&filter-crate=std
85+ [ iterreduce ] : ../../std/index.html?search=iterator<T>%2C%20fnmut%20->%20T&filter-crate=std
8486
8587### How type-based search works
8688
@@ -95,16 +97,23 @@ After deciding which items are type parameters and which are actual types, it
9597then searches by matching up the function parameters (written before the ` -> ` )
9698and the return types (written after the ` -> ` ). Type matching is order-agnostic,
9799and allows items to be left out of the query, but items that are present in the
98- query must be present in the function for it to match.
100+ query must be present in the function for it to match. The ` self ` parameter is
101+ treated the same as any other parameter, and ` Self ` is resolved to the
102+ underlying type's name.
99103
100104Function signature searches can query generics, wrapped in angle brackets, and
101105traits will be normalized like types in the search engine if no type parameters
102106match them. For example, a function with the signature
103107` fn my_function<I: Iterator<Item=u32>>(input: I) -> usize `
104108can be matched with the following queries:
105109
106- * ` Iterator<u32> -> usize `
107- * ` Iterator -> usize `
110+ * ` Iterator<Item=u32> -> usize `
111+ * ` Iterator<u32> -> usize ` (you can leave out the ` Item= ` part)
112+ * ` Iterator -> usize ` (you can leave out iterator's generic entirely)
113+ * ` T -> usize ` (you can match with a generic parameter)
114+
115+ Each of the above queries is progressively looser, except the last one
116+ would not match ` dyn Iterator ` , since that's not a type parameter.
108117
109118Generics and function parameters are order-agnostic, but sensitive to nesting
110119and number of matches. For example, a function with the signature
@@ -183,7 +192,8 @@ slice = OPEN-SQUARE-BRACKET [ nonempty-arg-list ] CLOSE-SQUARE-BRACKET
183192arg = [type-filter *WS COLON *WS] (path [generics] / slice / [!])
184193type-sep = COMMA/WS *(COMMA/WS)
185194nonempty-arg-list = *(type-sep) arg *(type-sep arg) *(type-sep)
186- generics = OPEN-ANGLE-BRACKET [ nonempty-arg-list ] *(type-sep)
195+ generic-arg-list = *(type-sep) arg [ EQUAL arg ] *(type-sep arg [ EQUAL arg ]) *(type-sep)
196+ generics = OPEN-ANGLE-BRACKET [ generic-arg-list ] *(type-sep)
187197 CLOSE-ANGLE-BRACKET
188198return-args = RETURN-ARROW *(type-sep) nonempty-arg-list
189199
@@ -230,6 +240,7 @@ DOUBLE-COLON = "::"
230240QUOTE = %x22
231241COMMA = ","
232242RETURN-ARROW = "->"
243+ EQUAL = "="
233244
234245ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
235246DIGIT = %x30-39
0 commit comments