Is it possible to see feature documentation on docs.rs?

Viewed 518

I'm looking at the documentation for gpio_cdev on docs.rs.

One of the optional features for that crate is async-tokio, which allows you to write async code to check GPIO pins. There is an example of this on the gpio_cdev github front page using AsyncLineEventHandle.

The problem I'm seeing is that the docs.rs documentation has absolutely no mention of AsyncLineEventHandle, or anything to do with Async.

Is there a button on the docs.rs website to show documentation for optional features? Are optional features never documented on docs.rs? Or is this up to the developer to include the documentation for optional features on docs.rs? Should I be filing a bug report for this?

I assume I'm able to see the documentation if I locally generate it using cargo doc (though I haven't tried this). Is this the only option?

Edit: Confirmed that as long as I have the feature enabled, locally generating docs does show the async parts.

2 Answers

It's possible to use docs.rs attributes like #[cfg_attr(docsrs, doc(cfg(feature = "async-tokio")))] and to set the crate defaults to show features on docs.rs, in the case of gpio-cdev this was recently added we just haven't published a release since.

As you have discovered you can always build / view rust docs locally (on any linux device the docs will be the same, this doesn't need to be on the RPi) with cargo doc --open --all-features to enable all features, and opening an issue or PR as suggested by @nelsonjchen / you have to let us know it's missing is great ^_^

Related