diff options
| author | binarycat <binarycat@envs.net> | 2025-01-13 15:31:15 -0600 |
|---|---|---|
| committer | binarycat <binarycat@envs.net> | 2025-01-16 11:52:00 -0600 |
| commit | 9397d133f683070863029552313b5e083398bf42 (patch) | |
| tree | 51632cf584458936608639cfb0efc67f2d3c09e0 /src/doc/rustdoc | |
| parent | d8a64098c9d0fb25699f657c6efff0bb418f7e18 (diff) | |
| download | rust-9397d133f683070863029552313b5e083398bf42.tar.gz rust-9397d133f683070863029552313b5e083398bf42.zip | |
Treat other items as functions for the purpose of type-based search
constants and statics are nullary functions, and struct fields are unary functions. functions (along with methods and trait methods) are prioritized over other items, like fields and constants.
Diffstat (limited to 'src/doc/rustdoc')
| -rw-r--r-- | src/doc/rustdoc/src/read-documentation/search.md | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/doc/rustdoc/src/read-documentation/search.md b/src/doc/rustdoc/src/read-documentation/search.md index e06dcdb7ed2..bace2f5f953 100644 --- a/src/doc/rustdoc/src/read-documentation/search.md +++ b/src/doc/rustdoc/src/read-documentation/search.md @@ -52,9 +52,10 @@ methods on the allocator or free functions. [`Layout`]: ../../alloc/index.html?search=Layout&filter-crate=alloc -## Searching By Type Signature for functions +## Searching By Type Signature If you know more specifically what the function you want to look at does, +or you want to know how to get from one type to another, Rustdoc can search by more than one type at once in the parameters and return value. Multiple parameters are separated by `,` commas, and the return value is written with after a `->` arrow. @@ -86,6 +87,17 @@ the standard library and functions that are included in the results list: [iterasslice]: ../../std/vec/struct.Vec.html?search=vec%3A%3Aintoiter<T>%20->%20[T]&filter-crate=std [iterreduce]: ../../std/index.html?search=iterator<T>%2C%20fnmut%20->%20T&filter-crate=std +### Non-functions in type-based search +Certain items that are not functions are treated as though they +were a semantically equivelent function. + +For example, struct fields are treated as though they were getter methods. +This means that a search for `CpuidResult -> u32` will show +the `CpuidResult::eax` field in the results. + +Additionally, `const` and `static` items are treated as nullary functions, +so `-> u32` will match `u32::MAX`. + ### How type-based search works In a complex type-based search, Rustdoc always treats every item's name as literal. |
