Skip to content

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

Open
@lf-

Description

@lf-
Contributor

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)

Activity

dns2utf8

dns2utf8 commented on Sep 5, 2021

@dns2utf8
Contributor

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

GuillaumeGomez commented on Sep 5, 2021

@GuillaumeGomez
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
added
A-rustdoc-jsArea: Rustdoc's JS front-end
T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.
on Sep 5, 2021
dns2utf8

dns2utf8 commented on Sep 5, 2021

@dns2utf8
Contributor

Ah, now I understand 👍

GuillaumeGomez

GuillaumeGomez commented on Sep 5, 2021

@GuillaumeGomez
Member

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

lolbinarycat commented on Sep 27, 2024

@lolbinarycat
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-jsArea: Rustdoc's JS front-endA-rustdoc-searchArea: Rustdoc's search featureC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dns2utf8@GuillaumeGomez@lf-@lolbinarycat

        Issue actions

          Rustdoc search feature request: support a "field" item kind filter · Issue #88660 · rust-lang/rust