Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustdoc search feature request: support a "field" item kind filter #88660

Open
lf- opened this issue Sep 5, 2021 · 5 comments
Open

Rustdoc search feature request: support a "field" item kind filter #88660

lf- opened this issue Sep 5, 2021 · 5 comments
Labels
A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-search Area: Rustdoc's search feature C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@lf-
Copy link
Contributor

lf- commented Sep 5, 2021

Currently, according to the help menu,

Prefix searches with a type followed by a colon (e.g., fn:) to restrict the search to a given item kind.
Accepted kinds are: fn, mod, struct, enum, trait, type, macro, and const.

However, fields are found by the search, it's just not possible to filter to only include them. It would be useful to be able to do so.

rust version: rustc 1.56.0-nightly (d3e2578 2021-08-21)

@dns2utf8
Copy link
Contributor

dns2utf8 commented Sep 5, 2021

I did a search for fn:parse and the results it returned are functions that are named similareley:
https://doc.rust-lang.org/nightly/std/?search=fn%3Aparse
image

What query did you use? And where did you host it?

Cheers,
Stefan

cc: @rustdoc @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

@dns2utf8: I think they meant that they wanted something like:

pub struct Foo {
    pub a: u32,
}

Then search it like this:

field:a
// or:
field:u32

@GuillaumeGomez GuillaumeGomez added A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-search Area: Rustdoc's search feature T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Sep 5, 2021
@dns2utf8
Copy link
Contributor

dns2utf8 commented Sep 5, 2021

Ah, now I understand 👍

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Sep 5, 2021

I guess a variant filter would be nice too, or maybe we just consider variant and field as the same thing. In any case, it'll have to wait for the rework of the rustdoc search I'm working on (which is currently waiting for #88268 to be merged).

@lolbinarycat
Copy link
Contributor

structfield and variant do seem to exist, but they aren't listed in the quick help menu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-search Area: Rustdoc's search feature C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants