Initial commit - Hello Cargo
This commit is contained in:
commit
2b617a5c4e
4 changed files with 68 additions and 0 deletions
11
.gitignore
vendored
Normal file
11
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Generated with gitingore.io
|
||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
45
README.md
Normal file
45
README.md
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
Rust "The Book" exercices
|
||||||
|
=========================
|
||||||
|
|
||||||
|
A collection of the examples/exercices/... found in the rust tutorial "The Book", collected for my own reference.
|
||||||
|
|
||||||
|
Interesting commands
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
### Compile ###
|
||||||
|
|
||||||
|
1. Debug
|
||||||
|
```
|
||||||
|
$> cargo build
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Release
|
||||||
|
```
|
||||||
|
$> cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Check
|
||||||
|
|
||||||
|
This is usefull in f.e. CI's to quickly check if our project can compile:
|
||||||
|
```
|
||||||
|
$> cargo check
|
||||||
|
```
|
||||||
|
|
||||||
|
### Documentation ###
|
||||||
|
|
||||||
|
Make and open the documentation in your favorite web browser:
|
||||||
|
```
|
||||||
|
$> cargo doc --open
|
||||||
|
```
|
||||||
|
|
||||||
|
### Format ###
|
||||||
|
|
||||||
|
To format the code:
|
||||||
|
```
|
||||||
|
$> cargo fmt
|
||||||
|
```
|
||||||
|
|
||||||
|
Interesting things to know
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
* A char is 4 bytes in Rust!
|
||||||
9
hello_cargo/Cargo.toml
Normal file
9
hello_cargo/Cargo.toml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[package]
|
||||||
|
name = "hello_cargo"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["laurens <miers132@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
3
hello_cargo/src/main.rs
Normal file
3
hello_cargo/src/main.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, cargo!");
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue