diff options
| author | Michael Howell <michael@notriddle.com> | 2023-11-22 18:20:31 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-12-26 12:54:17 -0700 |
| commit | e74339bd4b70ee93ca380c496e53177fd19193af (patch) | |
| tree | 2eaa7d8d1edf38b1ad91e636732aad3abd8acbda | |
| parent | f6a045cc6b24dd033c207dd63d8adccdedf672d2 (diff) | |
| download | rust-e74339bd4b70ee93ca380c496e53177fd19193af.tar.gz rust-e74339bd4b70ee93ca380c496e53177fd19193af.zip | |
Add a few more docs
| -rw-r--r-- | src/doc/rustdoc/src/read-documentation/search.md | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/src/doc/rustdoc/src/read-documentation/search.md b/src/doc/rustdoc/src/read-documentation/search.md index d773794504e..b5f4060f059 100644 --- a/src/doc/rustdoc/src/read-documentation/search.md +++ b/src/doc/rustdoc/src/read-documentation/search.md @@ -147,45 +147,20 @@ will match these queries: * `Read -> Result<Vec<u8>, Error>` * `Read -> Result<Error, Vec>` * `Read -> Result<Vec<u8>>` +* `Read -> u8` But it *does not* match `Result<Vec, u8>` or `Result<u8<Vec>>`. ### Primitives with Special Syntax -<table> -<thead> - <tr> - <th>Shorthand</th> - <th>Explicit names</th> - </tr> -</thead> -<tbody> - <tr> - <td><code>[]</code></td> - <td><code>primitive:slice</code> and/or <code>primitive:array</code></td> - </tr> - <tr> - <td><code>[T]</code></td> - <td><code>primitive:slice<T></code> and/or <code>primitive:array<T></code></td> - </tr> - <tr> - <td><code>()</code></td> - <td><code>primitive:unit</code> and/or <code>primitive:tuple</code></td> - </tr> - <tr> - <td><code>(T)</code></td> - <td><code>T</code></td> - </tr> - <tr> - <td><code>(T,)</code></td> - <td><code>primitive:tuple<T></code></td> - </tr> - <tr> - <td><code>!</code></td> - <td><code>primitive:never</code></td> - </tr> -</tbody> -</table> +| Shorthand | Explicit names | +| --------- | ------------------------------------------------ | +| `[]` | `primitive:slice` and/or `primitive:array` | +| `[T]` | `primitive:slice<T>` and/or `primitive:array<T>` | +| `()` | `primitive:unit` and/or `primitive:tuple` | +| `(T)` | `T` | +| `(T,)` | `primitive:tuple<T>` | +| `!` | `primitive:never` | When searching for `[]`, Rustdoc will return search results with either slices 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 match both `unit` and `tuple`, and if there's more than one type (or a trailing or leading comma) it is the same as `primitive:tuple<...>`. +However, since items can be left out of the query, `(T)` will still return +results for types that match tuples, even though it also matches the type on +its own. That is, `(u32)` matches `(u32,)` for the exact same reason that it +also matches `Result<u32, Error>`. + ### Limitations and quirks of type-based search Type-based search is still a buggy, experimental, work-in-progress feature. |
