Documenting benchmarks

We have a Criterion benchmark suite in benches that needs documentation. However we could not find anywhere instructions to generate documentation from the source files in benches. cargo doc appears to generate documentation only for the src directory.

What is the best practice to document benchmarks (inside the benchmark code)?

UPDATE: I discovered the --bench option of cargo rustdoc, and indeed

cargo rustdoc --features cli --bench sux

shows that cargo is trying to generate documentation for the files in benches/sux. Unfortunately it does not recognize any of the dependencies therein, not even criterion or sux (the main crate). Any suggestion?

If it is such an important benchmark that you want to document it, maybe moving it to its own package (possibly inside the same workspace the package you are benchmarking resides) would be the easiest solution? Cargo's benchsuite is its own package, for example.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.