Open
Description
Problem
The official package layout says that there can be an examples
folder in a cargo package. This examples
folder currently supports
examples/foo.rs
standalone filesexamples/foo/main.rs
files in subfolders with supporting modules
I can compile and run these examples with
cargo run --example foo
However, some examples require a more complex setup. The examples folder of the axum project contains many subfolders and each subfolder contains a cargo package with a Cargo.toml
.
It would be nice if cargo run --example foo
supported a third case:
examples/foo/Cargo.toml
should run the default binary from the cargo example package.
Proposed Solution
- Implement support for finding examples with
Cargo.toml
files inside theexamples
folder - Easy solution: Automatically change into the directory of the examples crate and start a
cargo run
subprocess.
Notes
No response