1/ It happened to me run examples in this repo https://github.com/0xProject/OpenZKP
One of way to an example is
cargo run --release --example small_fib
I'm just curious why we can run the example small_fib
at the root directory even the example small_fib is located in a subdir project as this repo consists of multiple projects.
2/ Another question is that the small_fib
example was not specified in example section of the Cargo.toml but we can execute it with
cargo run --release --example small_fib
To answer your first question, the crypto/stark
folder is added to the workspace
section of the root's Cargo.toml
. See the Cargo book about how this section works:
Whenever any crate in the workspace is compiled, output is placed in the workspace root (i.e., next to the root crate's Cargo.toml).
For your second question, the small_fib.rs
file is placed in the examples
folder of crypto/stark
. It can be run directly as an example. I found this article to be very informative about Rust examples.
The important thing is that you don’t have to worry what to do with your example code anymore. All you need to do is drop it in the examples/ directory, and let Cargo do the rest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With