vcfxb
March 21, 2023, 10:13pm
1
Hi all,
Say I have a wrapper type, Wrapper<T>
and I want all the methods implemented in impl Wrapper<T>
to show up in the documentation page for struct T
instead of struct Wrapper
. Is there any good way to do that?
Thanks!
kornel
March 21, 2023, 11:51pm
2
There isn't:
rust-lang:master
← elahn:delegation2018
opened 10:07AM - 06 Apr 18 UTC
Syntax sugar for efficient code reuse via the composition pattern. Wrapper funct… ions are generated for a struct, delegating most or all of a trait’s `impl` block to a member field that already implements the trait.
[Rendered](https://github.com/elahn/rfcs/blob/delegation2018/text/0000-delegation.md)
### Please Note:
This RFC is a group effort from the Rust community. Whenever an issue is raised, please edit the [RFC draft](https://hackmd.io/ZUEHoEgwRF29hbcIyUXIiw?edit) to address it as best you can.
If the design needs to be bikeshedded, please do so [on this internals thread](https://internals.rust-lang.org/t/new-rfc-for-delegation-anyone-interested-in-contributing/6644).
Whenever an issue or question has been resolved, [please submit a PR to this RFC](https://github.com/elahn/rfcs/tree/delegation2018).
---------
Thank you, everyone for your contributions, they’ve been a big help. If we continue this collaborative style throughout the RFC process, I’ve no doubt we can address any concerns that arise and get this puppy accepted!
The best you can do is to implement Deref
:
but in terms of docs it shows up the other way - Wrapper
docs will show docs of the type it derefs to.
vcfxb
March 22, 2023, 2:08pm
3
That makes sense, thanks so much
system
Closed
June 20, 2023, 2:09pm
4
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.