-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Allow search to find methods involving a type even when wrapped in another type #139665
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
Comments
( I did some slight reformatting to make it readable). This is a request not to docs.rs, but to rustdoc itself. cc @GuillaumeGomez should we move it? Or does it already exist? |
It should be on rust repository indeed. Moving it. |
This is #127589 |
@notriddle @syphar @GuillaumeGomez Please take a look at the above comment and help me if I’m doing the search incorrectly, if this feature has already been merged, or if there’s any documentation on how to use the search—please point me to it. From my perspective, nobody should need to learn how to search; it should be straightforward and intuitive. You simply search for something, and it should just appear. For example, I should be able to search for Metadata, and the DirEntry::metadata method should immediately appear, as simple as that. |
You're right. In this case, it's supposed to unbox the |
Thanks! @notriddle Could you please assign someone to address this bug? Additionally, just as a gentle reminder, the fix shouldn't be limited only to unwrapping a single generic layer, but should also handle multiple nested layers of genetics. For example, if we have a method returning a deeply nested type like |
Vec isn't marked as unboxable, so that example won't work.
|
That will do the job. It is fine to skip the type which are not marked as unboxable. |
…x, r=GuillaumeGomez rustdoc-search: add unbox flag to Result aliases Fixes rust-lang#139665
Rollup merge of rust-lang#139688 - rust-lang:notriddle/io-result-unbox, r=GuillaumeGomez rustdoc-search: add unbox flag to Result aliases Fixes rust-lang#139665
…x, r=GuillaumeGomez rustdoc-search: add unbox flag to Result aliases Fixes rust-lang#139665
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.
The text was updated successfully, but these errors were encountered: