This guide will help you set up and run this Rust project on your local machine.
- Install Rust (includes
cargo
andrustc
) - Recommended: Install VS Code + Rust Analyzer extension
-
Clone the repository (if using Git):
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name
-
Navigate to the project folder:
cd project-folder-name
Replace
project-folder-name
with the name of your Rust project (e.g.,consensus_simulation
). -
Build the project:
cargo build
-
Run the project:
cargo run
If your project has unit tests:
cargo test
project-folder-name/
├── src/
│ └── main.rs # Main Rust source file
├── Cargo.toml # Project metadata and dependencies
└── README.md # This file
To add a new crate (library), run:
cargo add crate_name
Example:
cargo add rand
Or manually edit
Cargo.toml
.
To remove compiled files and start fresh:
cargo clean