-
Notifications
You must be signed in to change notification settings - Fork 10
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
How to handle doc comments and examples? #54
Comments
That's an interesting use case that I haven't thought of before and is a bit challenging. First, the problem is that documentation comments are interpreted as strings, which #[duplicate_item(
name async comment_sub;
[some_fn] [ ] ["Comment for non-async"];
[some_async_fn] [async] ["Comment for async"];
)]
/// Some comment that will not be substituted.
#[doc = comment_sub]
async fn name() {
...
} Notice how /// Some comment that will not be substituted.
/// Comment for non-async
fn some_fn() {
...
}
/// Some comment that will not be substituted.
/// Comment for async
async fn some_async_fn() {
...
} I hope this helps. Let me know how it works out. |
Interesting 🤔I'll try it out and let you know how and if it worked out 🙈 |
After some testing, I can say that this works great for small differences, but is a bit unwieldy when trying to add different examples or something more complex. I will probably use Thanks again for the very quick reply and the great crate. I'll close this as resolved 🙃 |
Yeah, I had a feeling that would be the case. |
I want to use
duplicate
to create an asynchronous and a non-asynchronous version of a public method. Since this is a public API, I would like to have a proper doc comment and example. Currently both functions get the same comment, but I would like to have some small differences (especially in the example). Is there any way to achieve this?The text was updated successfully, but these errors were encountered: