You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//! In general, you can use the library like this
//! ```rust
//! use my_lib::foo;
//! assert!(foo())
//! ```
#![cfg_attr(
feature = "serde",
doc = r##"
## integration with `serde`
if you've enabled the optional `serde` feature, you can use the lib in fancy new ways!
\```rust
use my_lib::foo_method_that_requires_serde;
assert!(foo_method_that_requires_serde());
\```
"##
)]
However these aren't recognized as doc comments by cargo-readme.
rustdoc uses cfg/feature gated comments to produce UI like this, which I think is nice:
But perhaps less subjectively, doctests that require a feature will fail if that feature isn't enabled.
A brief dive into cargo-readme shows that this might be non-trivial. It looks like currently cargo-readme has implemented it's own parsing for comment extraction. I have no idea if it's possible, but maybe cargo-readme could actually use librustdoc to extract and parse comments?
Or, if you're feeling really evil you could generate the docs with rustdoc and parse the html back into markdown 😈
The text was updated successfully, but these errors were encountered:
Some of my docs are behind feature flags, e.g.
However these aren't recognized as doc comments by cargo-readme.
rustdoc uses cfg/feature gated comments to produce UI like this, which I think is nice:
But perhaps less subjectively, doctests that require a feature will fail if that feature isn't enabled.
A brief dive into cargo-readme shows that this might be non-trivial. It looks like currently cargo-readme has implemented it's own parsing for comment extraction. I have no idea if it's possible, but maybe cargo-readme could actually use librustdoc to extract and parse comments?
Or, if you're feeling really evil you could generate the docs with rustdoc and parse the html back into markdown 😈
The text was updated successfully, but these errors were encountered: