I'm trying to get docs.rs to scrape my crate's examples again - it worked once, but not since I added some dev dependencies...
The build log says
[INFO] [stderr] warning: Rustdoc did not scrape the following examples because they require dev-dependencies: flip, speed, clockwise_360, emergency_stop, wifi_wait_for_connection, take_off_and_land, remote_control, receive_video, show_video, move, drone_state
[INFO] [stderr] If you want Rustdoc to scrape these examples, then add `doc-scrape-examples = true`
[INFO] [stderr] to the [[example]] target configuration of at least one example.
(which is a bit wrong because that's all of them, but only a couple actually do, but that's another matter)
# added in Cargo.toml
[[example]]
name = "name"
doc-scrape-examples = true
where name belongs to flip, speed, clockwise_360, emergency_stop, wifi_wait_for_connection, take_off_and_land, remote_control, receive_video, show_video, move, drone_state in your case.
Note on dev-dependencies: documenting a library does not normally require the crate’s dev-dependencies. However, example targets require dev-deps. For backwards compatibility, -Z rustdoc-scrape-examples will not introduce a dev-deps requirement for cargo doc. Therefore examples will not be scraped from example targets under the following conditions:
No target being documented requires dev-deps, AND
At least one crate with targets being documented has dev-deps, AND
The doc-scrape-examples parameter is unset or false for all [[example]] targets.
If you want examples to be scraped from example targets, then you must not satisfy one of the above conditions. For example, you can set doc-scrape-examples to true for one example target, and that signals to Cargo that you are ok with dev-deps being build for cargo doc.
Thankyou! My tello-edu crate now has lovely scraped examples included in the docs.
This idea of automatically pulling in example code is a fantastic feature - I've not seen anything so helpful in any other language ecosystem. Well done to all involved! The Rust tooling really is a pleasure to use.