-
Notifications
You must be signed in to change notification settings - Fork 513
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
Hide windows-sys
's documentation behind a feature flag?
#2665
Comments
windows-sys
generates a large amount of documentation that many folks won't needwindows-sys
generates a lot of documentation, with no way to hide it via cargo doc
windows-sys
generates a lot of documentation, with no way to hide it via cargo doc
windows-sys
's documentation behind a feature flag?
windows-sys
's documentation behind a feature flag?windows
's and windows-sys
's documentation behind a feature flag?
windows
's and windows-sys
's documentation behind a feature flag?windows-sys
's documentation behind a feature flag?
So you'd like to generate docs for your crate and all dependencies except |
Yes. There is rust-lang/cargo#4049, however that was opened in 2017 with no plans to add it yet. Thus, as a stopgap, I'm hoping |
Hey, sorry for the delay. Been off the grid camping. 🏕️ Just catching up here but this is what I do. Is that sufficient?
|
@kennykerr While it could work, there's some problems I'd have with using that approach. When I'm building apps with Additionally, I use So suffice to say, I'm not exactly keen on that approach. |
Fair enough. I've been meaning to reduce the overhead of doc comments for other reasons, so I'll keep this in mind for that effort. |
Mainly just for me: if we add |
@kennykerr If it isn't too much effort, you may still want to leave a note (whether as a cargo warning when executing |
Not a fan of tying docs to a feature. It's not part of the standard cargo doc experience and folks will overlook it causing confusion. We should really try to lean on rust-lang/cargo#4049 more. |
@riverar I agree, and I would use rust-lang/cargo#4049 if it were already added - but given that it's been six years since that issue was opened, and there doesn't appear to be many comments, I hesitate to think that it'd be added soon. So for the interim (or in lieu of that arg, if we assume it'll never be added), I would hope to have some way to exclude |
Sure, I wouldn't exclude docs automatically. If provided, that would be something that you would have to opt in to. |
There are also cfg options. https://github.com/microsoft/windows-rs/blob/master/.cargo/config.toml |
Features are meant to be additive so that doesn't seem like a natural fit. I experimented with a cfg option but // lib.rs
#![cfg_attr(windows_doc_hidden, doc(hidden))] This would seem like the simplest and most natural way to skip doc generation for the crate, if it worked. |
@kennykerr I'm confused by that response. How I understand such a feature flag is that documentation would be hidden by default - and specifying the feature unhides it. Thus, the feature is additive in the sense that it adds documentation. I'm also confused by your proposed alternative - it seems to remove documentation if a flag is specified, which is most definitely not additive. So could you perhaps elaborate on how you see the issue? Perhaps explain why you feel the feature flag would be non-additive? |
I was assuming the docs feature would need to be enabled by default, but I don't suppose that is necessary. |
Ah, okay that makes sense. Yeah, my thought is that the vast majority of the time, Thus, the vast majority of Rust crates will have little need for the |
Suggestion
Hi! I've been building a program that uses the
bevy
game engine crate, and in the midst of this, I've found it useful to render documentation for everything viacargo doc
.However, I noticed that the
windows-sys
crate generates quite a lot of documentation. Unfortunately,cargo doc
has no way to exclude certain dependencies without excluding all dependencies (the--exclude
flag only seems to work on packages that are within the current workspace).I don't believe this is an issue with the
windows-sys
crate, per se - it's doing its job just fine. However, unless a user is usingwindows-sys
directly, they may not need to seewindows-sys
's documentation anyways - meaningwindows-sys
's documentation is simply wasting disk space, and worse, makingcargo clean
take a lot longer due to the mass amount of files generated.Still, some users may need
windows-sys
's docs, so hiding them behind a blanket#[doc(hidden)]
may not be a good idea. Perhapswindows-sys
could attach#[doc(hidden)]
to most stuff, unless a certain feature flag (let's saywindows-sys/render_docs
) is specified?I just think it may be useful to avoid generating so much documentation unless a user needs it.
The text was updated successfully, but these errors were encountered: