Table of contents
rust cli
cargo
create new empty project
cargo new [name]
don't create git dir
cargo new [name] --vcs=none
build and run
cargo run
create development build
cargo build
create new release
cargo build --release
clean build dir
cargo clean
find crates
cargo search [query]
show cargo version
cargo -V
cargo metadata
name = name of program, used to create binary
version = version of your project
authors = array containing author names
edition = major edition or rust to build project
defining a dependency
[dependencies]
[crate] = "[version]"
version specification
^1.2.3 = >=1.2.3, <2.0.0
^1.2 = >=1.2.0, <2.0.0
^1 = >=1.0.0, <2.0.0
^0.2.3 = >=0.2.3, <0.3.0
^0.2 = >=0.2.0, <0.3.0
^0.0.3 = >=0.0.3, <0.0.4
^0.0 = >=0.0.0, <0.1.0
^0 = >=0.0.0, <1.0.0
~1.2.3 = >=1.2.3, <1.3.0
~1.2 = >=1.2.0, <1.3.0
~1 = >=1.0.0, <2.0.0
* = >=0.0.0
1.* = >=1.0.0, <2.0.0
1.2.* = >=1.2.0, <1.3.0
or explicitly specify the version
>= 1.2.0
> 1
< 2
= 1.2.3
>= 1.2, < 1.5
cargo documentation
https://doc.rust-lang.org/stable/cargo/