From c9a4a47544cadf967c2c88027ea0a1ac187d152a Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 22 Nov 2023 18:20:31 -0700 Subject: [PATCH] Add a few more docs --- .../rustdoc/src/read-documentation/search.md | 48 ++++++------------- 1 file 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 d773794504e77..b5f4060f05905 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, Error>` * `Read -> Result` * `Read -> Result>` +* `Read -> u8` But it *does not* match `Result` or `Result>`. ### Primitives with Special Syntax - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ShorthandExplicit 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
+| Shorthand | Explicit names | +| --------- | ------------------------------------------------ | +| `[]` | `primitive:slice` and/or `primitive:array` | +| `[T]` | `primitive:slice` and/or `primitive:array` | +| `()` | `primitive:unit` and/or `primitive:tuple` | +| `(T)` | `T` | +| `(T,)` | `primitive:tuple` | +| `!` | `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`. + ### Limitations and quirks of type-based search Type-based search is still a buggy, experimental, work-in-progress feature.