I’m working on a library crate that exports testable properties (using traits) on user-defined types.
I’d like to add some example implementations and tests to the crate in the Cargo supported “examples” directory. The point of the examples is to demonstrate using the testable properties (with proptest) with some simple types and not to create runnable binaries that perform other actions.
If I understand correctly I can persuade Cargo to treat examples as libraries with a special clause in the cargo.toml file for each example:
[[example]] name = "example_1" path = "examples/example_1" crate-type = ["staticlib"]
Do all the rules around directories and modules also apply to these example libraries?
If anyone has an example of doing this successfully I’d be very grateful.