Skip to content

Commit c9a4a47

Browse files
committed
Add a few more docs
1 parent da5d870 commit c9a4a47

File tree

1 file changed

+14
-34
lines changed
  • src/doc/rustdoc/src/read-documentation

1 file changed

+14
-34
lines changed

src/doc/rustdoc/src/read-documentation/search.md

+14-34
Original file line numberDiff line numberDiff line change
@@ -147,45 +147,20 @@ will match these queries:
147147
* `Read -> Result<Vec<u8>, Error>`
148148
* `Read -> Result<Error, Vec>`
149149
* `Read -> Result<Vec<u8>>`
150+
* `Read -> u8`
150151

151152
But it *does not* match `Result<Vec, u8>` or `Result<u8<Vec>>`.
152153

153154
### Primitives with Special Syntax
154155

155-
<table>
156-
<thead>
157-
<tr>
158-
<th>Shorthand</th>
159-
<th>Explicit names</th>
160-
</tr>
161-
</thead>
162-
<tbody>
163-
<tr>
164-
<td><code>[]</code></td>
165-
<td><code>primitive:slice</code> and/or <code>primitive:array</code></td>
166-
</tr>
167-
<tr>
168-
<td><code>[T]</code></td>
169-
<td><code>primitive:slice&lt;T&gt;</code> and/or <code>primitive:array&lt;T&gt;</code></td>
170-
</tr>
171-
<tr>
172-
<td><code>()</code></td>
173-
<td><code>primitive:unit</code> and/or <code>primitive:tuple</code></td>
174-
</tr>
175-
<tr>
176-
<td><code>(T)</code></td>
177-
<td><code>T</code></td>
178-
</tr>
179-
<tr>
180-
<td><code>(T,)</code></td>
181-
<td><code>primitive:tuple&lt;T&gt;</code></td>
182-
</tr>
183-
<tr>
184-
<td><code>!</code></td>
185-
<td><code>primitive:never</code></td>
186-
</tr>
187-
</tbody>
188-
</table>
156+
| Shorthand | Explicit names |
157+
| --------- | ------------------------------------------------ |
158+
| `[]` | `primitive:slice` and/or `primitive:array` |
159+
| `[T]` | `primitive:slice<T>` and/or `primitive:array<T>` |
160+
| `()` | `primitive:unit` and/or `primitive:tuple` |
161+
| `(T)` | `T` |
162+
| `(T,)` | `primitive:tuple<T>` |
163+
| `!` | `primitive:never` |
189164

190165
When searching for `[]`, Rustdoc will return search results with either slices
191166
or arrays. If you know which one you want, you can force it to return results
@@ -200,6 +175,11 @@ since parens act as the grouping operator. If they're empty, though, they will
200175
match both `unit` and `tuple`, and if there's more than one type (or a trailing
201176
or leading comma) it is the same as `primitive:tuple<...>`.
202177

178+
However, since items can be left out of the query, `(T)` will still return
179+
results for types that match tuples, even though it also matches the type on
180+
its own. That is, `(u32)` matches `(u32,)` for the exact same reason that it
181+
also matches `Result<u32, Error>`.
182+
203183
### Limitations and quirks of type-based search
204184

205185
Type-based search is still a buggy, experimental, work-in-progress feature.

0 commit comments

Comments
 (0)