Skip to content

Allow search to find methods involving a type even when wrapped in another type #139665

Closed
@mohantandi

Description

@mohantandi

Currently, docs.rs search only matches exact type names. I'd like the search to include methods that return or accept a type even if that type is wrapped inside another type.

Example:
Suppose I have a struct called S, and a method defined as follows:

fn m(&self) -> E<S>

When I search for S, I expect to find this method listed in search results, even though the method returns E<S> rather than directly returning S.

Similarly, if a method takes an argument like E<S>:

fn another_method(arg: E<S>)

Then searching for S should also return another_method.

Deep/Nested Types:

This shouldn't be limited to just one level of wrapping. Ideally, the search should support multi-level nested types as well. For example:

fn complex_method() -> Arc<Mutex<S>>

This method should also show up when searching for S, despite S being deeply wrapped inside Arc and Mutex.

UI Suggestion:

If showing deeply nested matches by default is considered too noisy or expensive, it would be great to have a toggle or checkbox in the UI settings to enable "nested type search". That way, users who want deeper results can opt in when needed.

This enhancement would significantly improve the discoverability of methods and types, especially when generics and error handling wrappers are involved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-searchArea: Rustdoc's search featureA-type-based-searchArea: Searching rustdoc pages using type signaturesT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions