mongo-rust-driver icon indicating copy to clipboard operation
mongo-rust-driver copied to clipboard

RUST-1512 Better links for action return types

Open abr-egn opened this issue 1 year ago • 0 comments

RUST-1512

For return types in code that include generic parameters, rustdoc will generate output that links to both the generic type and the parameter types; however, when using bracketed comment links, the generic parameters are ignored. This means that the action documentation for what await or run returns is less useful than previously, especially in cases of deeply nested types like Result<ChangeStream<ChangeStreamEvent<Document>>>. For particularly gnarly cases I attempted to manually link components but this is fiddly, error-prone, and easy to forget.

This PR addresses that by introducing a helper #[deeplink] attr macro that will look for docstring links of the form d[...] and render them with all component types individually linked. The core trick is that /// stuff comments are actually syntactic sugar for #[doc = "stuff"] attributes, which the attr macro can then update.

abr-egn avatar Mar 25 '24 15:03 abr-egn