Installing Rust and VS Code Editor
- install Rust from rustup.rs
- you can install it through commands
- Cargo: Package manager. to install packages and to keep track of dependencies and other related stuffs
- you can use web compiler:
play-rust
Running and Compiling your program
- to run rust file, use this command
- rustc [filename].rs
- ./[filename]
- using cargo: two scenarios
- stage of development(cargo build)
- where you'd like to rebuild quickly and often, since we are in the process of wrting the code and we have not yet finalized the code
- done with the code
- like to finalize the program that we will be handing over to the user
- So in this case we won't be rebuilding repeatedly. The objective will be that the code runs as fast as possible. In this scenario, we will use build using the release options which will do the optimizations for us.
- you need these things below.
- cargo new [your project name]
- cargo run or cargo build (--release)