@@ -115,6 +115,30 @@ can be matched with the following queries:
115
115
Each of the above queries is progressively looser, except the last one
116
116
would not match ` dyn Iterator ` , since that's not a type parameter.
117
117
118
+ If a bound has multiple associated types, specifying the name allows you to
119
+ pick which one gets matched. If no name is specified, then the query will
120
+ match of any of them. For example,
121
+
122
+ ``` rust
123
+ pub trait MyTrait {
124
+ type First ;
125
+ type Second ;
126
+ }
127
+
128
+ /// This function can be found using the following search queries:
129
+ ///
130
+ /// MyTrait<First=u8, Second=u32> -> bool
131
+ /// MyTrait<u32, First=u8> -> bool
132
+ /// MyTrait<Second=u32> -> bool
133
+ /// MyTrait<u32, u8> -> bool
134
+ ///
135
+ /// The following queries, however, will *not* match it:
136
+ ///
137
+ /// MyTrait<First=u32> -> bool
138
+ /// MyTrait<u32, u32> -> bool
139
+ pub fn my_fn (x : impl MyTrait <First = u8 , Second = u32 >) -> bool { true }
140
+ ```
141
+
118
142
Generics and function parameters are order-agnostic, but sensitive to nesting
119
143
and number of matches. For example, a function with the signature
120
144
` fn read_all(&mut self: impl Read) -> Result<Vec<u8>, Error> `
@@ -143,6 +167,10 @@ Most of these limitations should be addressed in future version of Rustdoc.
143
167
with that bound, it'll match, but ` option<T> -> T where T: Default `
144
168
cannot be precisely searched for (use ` option<Default> -> Default ` ).
145
169
170
+ * Supertraits, type aliases, and Deref are all ignored. Search mostly
171
+ operates on type signatures * as written* , and not as they are
172
+ represented within the compiler.
173
+
146
174
* Type parameters match type parameters, such that ` Option<A> ` matches
147
175
` Option<T> ` , but never match concrete types in function signatures.
148
176
A trait named as if it were a type, such as ` Option<Read> ` , will match
0 commit comments