These will show Noir side-by-side against Rust by example.
The goal is to highlight the similarities and differences in the language and design patterns.
You will need:
nargoinstalled via noirup. Tested with 1.0.0-beta.6 (noirup -v 1.0.0-beta.6)cargoinstalled via rustup (optional: to see Rust output)
The surrounding build artifacts (and additional proving/verifying artifacts for Noir) are not explored in this example.
The following commands can be run at the top level noir_by_example, or within the specific topic directory.
Eg: cd simple_macros
nargo compilecargo build
- Noir:
nargo check# May need to populate values in Prover.toml for topics that need itnargo execute
- Rust:
cargo run# topic-level only
Simply run:
nargo testcargo test
To see output from println:
nargo test --show-outputcargo test -- --nocapture
To test specific functions, a substring of its name can be added to the end.
Eg, nargo test macro, to run tests who's name contains the string macro.
The Noir documentation has many good pages explaining the syntax with examples, similarly with Rust.
For instance for macro function example:
- Noir example in (Quasi) Quote
- Rust example in macros
To add a new section:
- Go to the directory:
cd noir_by_example - Use the script:
./new_topic.sh topic_name - Then equivalent functionality to the
noirandrustprojects.