Add content

This commit is contained in:
finga 2021-09-21 10:26:56 +02:00
parent 1db227f540
commit 32bcca1530

View file

@ -70,34 +70,122 @@
- Careless (use of ~unsafe~ in) libraries can secretly break
safety guarantees.
** Where to start?
*** First Steps
- [[https://tourofrust.com/TOC_en.html][Tour of Rust]]
- [[https://doc.rust-lang.org/book/][The Rust Book]] (~$ rustup docs --book~)
- [[https://dhghomon.github.io/easy_rust/Chapter_1.html][Rust in Easy English]]
- [[https://doc.rust-lang.org/rust-by-example/][Rust by Example]] (~$ rustup docs --rust-by-example~)
- [[https://doc.rust-lang.org/std/][The Rust Standard Library]] (~$ rustup docs --std~)
- [[https://doc.rust-lang.org/nomicon/][The Rustonomicon]]: About unsafe Rust (~$ rustup docs --nomicon~)
- Use '~$ rustup help docs~' to get an overview
*** Helpful sites
- [[https://cheats.rs][cheats.rs]]
- [[https://programming-idioms.org/cheatsheet/Rust][programming-idioms.org]]
** Where to find help and stay up to date
*** Chat (Discord)
- [[https://discord.gg/rust-lang][The Rust Programming Language]]
- [[https://discord.com/invite/tcbkpyQ][The Rust Programming Language Community Server]]
*** Boards/Blogs
- [[https://blog.rust-lang.org/][Rust Blog]]
- [[https://www.reddit.com/r/rust][r/rust]]
- [[https://this-week-in-rust.org/][This Week in Rust]]
* Cargo
** Cargo
#+BEGIN_CENTER
\Huge *Cargo*
#+END_CENTER
#+ATTR_LaTeX: :height 0.4\textwidth
[[./img/cargo.png]]
** What is it?
- Package manager
- Build tool
- A Cargo project contains least one crate
** Docs
- [[https://doc.rust-lang.org/cargo/index.html][The Cargo Book]] (~$ rustup docs --cargo~)
** Cargo commands/plugins
*** What I typically use
- ~audit~: Audit ~Cargo.lock~ for security vulnerabilities.
- ~bloat~: Identify which dependency adds how much bloat.
- ~checkmate~: Run a list of checks (~check~, ~format~, ~build~,
~test~, ~doc~, ~audit~).
- ~clippy~: Linter and static code analysis.
- ~deb~: Automatically create a binary Debian package.
- ~edit~: Modify your ~Cargo.toml~ from the command line.
- ~flamegraph~: Generate flamegraphs about anything.
- ~fmt~: Format Rust code according to style guidelines.
- ~install-update~: Keep all your Cargo commands up to date.
* Setup
** Install the Rust-Toolchain
*** Install Rust
From [[https://rustup.rs][rustup.rs]]:
~$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh~
*** Rustup: The Rust toolchain installer
- Check for new versions: ~$ rustup check~
- Update the toolchain: ~$ rustup update~
- Update rustup itself: ~$ rustup self update~
- Install Rust nightly (daily builds):
~$ rustup toolchain install nightly~
- Activate nightly globally: ~$ rustup default nightly~
- Activate nightly locally (in current dir):
~$ rustup override set nightly~
* Hands on
* Testing
* Documentation
* IDE support
* Cargo plugins
* WebDev
* Embedded
[[https://areweideyet.com/][Are we IDE yet]]
* (Standard?) crates
- [[https://crates.io][crates.io]]/[[https://lib.rs][lib.rs]]
- [[https://github.com/rust-unofficial/awesome-rust][Awesome Rust]]
* Further information
- clap (command line argument parser)
- env_logger, log
- dotenv
- serde
- lazy_static, once_cell (globality, singleton, lazy initialization)
- nom
- tokio
** Databases
- sqlx
- diesel
** WebDev
[[https://www.arewewebyet.org/][Are we web yet]]
- Actix
- Hyper
- Rocket
- reqwest
** Embedded
[[https://niclashoyer.github.io/areweembeddedyet/][Are we embedded yet]]
[[https://niclashoyer.github.io/areweembeddedyet/][Awesome Embedded Rust]]
[[https://docs.rust-embedded.org/embedonomicon/][Embedonomicon]]
- avr
- stm
- msp430
- esp32
* Footnotes
[fn:1] [[https://commons.wikimedia.org/wiki/File:Bruine_roest_op_tarwe_(Puccinia_recondita_f.sp._tritici_on_Triticum_aestivum).jpg][Wikimedia]]
[fn:2] Copied list from: https://cheats.rs.
[fn:2] Copied from: https://cheats.rs.
[fn:3] Work on GCC: [[https://rust-gcc.github.io/][rust-gcc]] and [[https://news.ycombinator.com/item?id=27775544][gcc rust backend]].
[fn:4] [[https://blog.rust-lang.org/2020/04/17/Rust-survey-2019.html#why-not-use-rust][Rust survey]]
[fn:5] [[https://news.ycombinator.com/item?id=23538220][The Rust compiler isn't slow; we are]]