bitcode icon indicating copy to clipboard operation
bitcode copied to clipboard

Have docs.rs create docs for all features

Open WyvernIXTL opened this issue 4 months ago • 5 comments

Cargo.toml should have set

[package.metadata.docs.rs]
all-features = true

instead of just

features = [ "derive", "serde", "std" ]

This way a single search is enough to check whether bitcode itself supports a format and what feature flag is necessary to enable said format.

It took me quite a lot of time to realize, that bitcode does in fact support time. I did not check the Cargo.toml, but rather expected the docs on docs.rs to be complete.

WyvernIXTL avatar Oct 04 '25 19:10 WyvernIXTL

Docs.rs does show all the features, here: https://docs.rs/crate/bitcode/latest/features

It just doesn't show the API's related to disabled features. These API's could get cluttered if many more crates were supported.

finnbear avatar Oct 04 '25 19:10 finnbear

I did compile the docs with all features. Imo. they looked perfectly fine and I instantly was able to determine, what crates bitcode supports.

If this is not an option, there should be a note in the Readme or somewhere in the docs, what other crates bitcode has support for.

WyvernIXTL avatar Oct 04 '25 19:10 WyvernIXTL

Docs.rs does show all the features, here: https://docs.rs/crate/bitcode/latest/features

You're right about that.

Though docs.rs sais on the same page:

There is very little structured metadata to build this page from currently. You should check the main library docs, readme, or Cargo.toml in case the author documented the features in them.

And that is not an excuse for me not looking, but I simply did not think about checking the feature flags in docs.rs. (A contradictory statement 😬)

I still think, that there should be a top level doc with a table or something, that explains each feature.

WyvernIXTL avatar Oct 04 '25 20:10 WyvernIXTL

There is very little structured metadata to build this page from currently.

Huh, this is confusing to me. I'm not sure what structured metadata we could add. Structured metadata seems separate from the docs you suggest. Are there any crates without this warning in there docs? I checked, and even serde has the warning.

finnbear avatar Oct 04 '25 20:10 finnbear

That warning is shown for every crate. Cargo.toml currently has no fields for documenting features. So the feature page on docs.rs is quite bare.

When the features have a special meaning or should be easily found, then it is better to have them documented at top level.

Like this: https://docs.rs/tokio/latest/tokio/#feature-flags

WyvernIXTL avatar Oct 04 '25 20:10 WyvernIXTL