commit 2b617a5c4e1d6253924b33286da1f6c75cf8f266 Author: laurens Date: Fri May 1 18:54:07 2020 +0200 Initial commit - Hello Cargo diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c78e944 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..519f68b --- /dev/null +++ b/README.md @@ -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! diff --git a/hello_cargo/Cargo.toml b/hello_cargo/Cargo.toml new file mode 100644 index 0000000..0f7aa75 --- /dev/null +++ b/hello_cargo/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "hello_cargo" +version = "0.1.0" +authors = ["laurens "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/hello_cargo/src/main.rs b/hello_cargo/src/main.rs new file mode 100644 index 0000000..b30ea97 --- /dev/null +++ b/hello_cargo/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, cargo!"); +}