Skip to content
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

Add a way to copy doc comments from a different item #896

Open
segevfiner opened this issue Nov 3, 2023 · 1 comment
Open

Add a way to copy doc comments from a different item #896

segevfiner opened this issue Nov 3, 2023 · 1 comment

Comments

@segevfiner
Copy link

When building a C API for an existing crate with a Rust centric API. You often write wrapper functions that wrap the Rust API into something suitable for C, e.g. boxing stuff into raw pointers, error handling, etc. I would be nice to be able to specify that cbindgen should copy the documentation comment of another item when generating the header so you can copy it from the original wrapped item without duplicating the comment in the code.

@kriswuollett
Copy link

kriswuollett commented Dec 5, 2023

Have same issue and tried a workaround that I expected to work. However cbindgen is not adding the contents of #[doc = include_str!("sample.md")] when applied to an enum variant, while a comment like /// sample is added to the enum variant definition in the C language output. I think the doc include string may be the most directly supported way in Rust to copy doc comments, whether or not an IDE supports it for tooltips?

However then I'd get into the issue of whether or not the target language supports Markdown in code comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants