I am wondering if there is a way to define dependencies only used for examples in the /example folder. I know that there is [dev-dependencies]
witch is for test/bench only (and build script?) dependencies I also know that the examples build when running cargo test. So is it safe to use [dev-dependencies]
for example only dependencies?
EDIT:
When using [dev-dependencies]
for a more complex scenario, a problem appeared witch did not occur when moving the example to it’s own repo.
So using [dev-dependencies]
might not be the best option some scenarios (some feature based variation might still work).
The Problem occurred in a scenario where the crate exposes some traits and the example used implementations for the traits provided by a different crate. The compiler was no longer able to determine that the implementing struct from the other create implemented the interface provided by this crate (through it did, but then it was kind of a circular dependency). After moving the example to it’s own repo, importing all dependencies “normal” the problem was solved (without changing any source code).