Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1634,14 +1634,23 @@ function preLoadCss(cssUrl) {
addClass(div_shortcuts, "shortcuts");
div_shortcuts.innerHTML = "<h2>Keyboard Shortcuts</h2><dl>" + shortcuts + "</dl></div>";

// FIXME: Find a better way to keep this list up-to-date with search.js `itemTypes` and
// `rustdoc::formats::item_type::ItemType`.
let filters = [
"keyword", "primitive", "mod", "externcrate", "import", "struct", "enum", "fn", "type",
"static", "trait", "impl", "tymethod", "method", "structfield", "variant", "macro",
"associatedtype", "constant", "associatedconstant", "union", "foreigntype",
"existential", "attr", "derive", "traitalias", "generic", "attribute",
];
filters.sort();
filters = filters.map(f => `<code>${f}</code>`);
const last = filters.pop();
const infos = [
`For a full list of all search features, take a look \
<a href="${drloChannel}/rustdoc/read-documentation/search.html">here</a>.`,
"Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to \
restrict the search to a given item kind.",
"Accepted kinds are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \
<code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, \
and <code>const</code>.",
`Accepted kinds are: ${filters.join(", ")} and ${last}.`,
"Search functions by type signature (e.g., <code>vec -&gt; usize</code> or \
<code>-&gt; vec</code> or <code>String, enum:Cow -&gt; bool</code>)",
"You can look for items with an exact name by putting double quotes around \
Expand Down
Loading