The Rust package manager, cargo, allows us to create a new project very easily with just one command, cargo new. Let's run it as follow:
cargo new tetris --binYou should have a new folder tetris containing the following:
tetris/
|
|- Cargo.toml
|- src/
|
|- main.rs
Note that if you ran cargo new without the --bin flag, then you will have a lib.rs file instead of main.rs.
Now write this into your Cargo.toml file:
[package]
name = "tetris"
version = "0.0.1"
[dependencies]
sdl2 = "0.30.0"
Here, we declare that our project's name is tetris, its version is 0.0.1 (it isn't really important at the moment), and that it has a dependency on the sdl2 crate.
For the versioning, Cargo follows SemVer (Semantic Versioning). It works as follows:
[major...