curl https://sh.rustup.rs -sSf | sh # installation
source $HOME/.cargo/env # configure current shell
rustc --version # check rust version
cargo --version # check cargo (Rust's package manager) version
cargo build # build the project
rustup update # update rust
mkdir ~/rustprojects # make a rust directory
cd ~/rustprojects
mkdir testdir # make a dir for test code
cd testdir
vi main.rs # create test app
fn main() { println!("Hello, World!"); }
rustc main.rs # compile test app
./main # run test app
cargo new hello-world # create and setup and new project (like 'go mod init')
cargo run # build and run the code
rustup self uninstall # uninstall rust
NOTE: be sure to run cargo build
after adding dependencies in the Cargo.toml file
Based on this video series
OUTPUT:
aaron@ubuntu-mini:~/rustprojects/akhil-first-proj$ cargo run
Compiling akhil-first-proj v0.1.0 (/home/aaron/rustprojects/akhil-first-proj)
Finished dev [unoptimized + debuginfo] target(s) in 0.62s
Running `target/debug/akhil-first-proj`
___________________________
< Hello, fellow rustaceans! >
---------------------------
\
\
_~^~^~_
\) / o o \ (/
'_ - _'
/ '-----' \
Variables in Rust are immutable unless defined using the mut
keyword.
Compress a file to zip
Decompress a file // extract a zip file into its original dir structure
- based on this yt video
- yt video's code