summaryrefslogtreecommitdiffstats
path: root/computer/programming/rust.md
blob: 2c2830965587e990385fa61d0ec65df431edb4fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
title: Rust
---


[Official website](https://www.rust-lang.org/)


## Resources

* [crates.io](https://crates.io) - Installable library and binary crates
* [docs.rs](https://docs.rs) - All documentation of crates from crates.io
* [lib.rs](https://lib.rs) - Alternative to crates.io
* [std.rs](https://std.rs) - Standard library documentation
* [blessed.rs](https://blessed.rs/crates) - Beginner guide to crates


### Learning Resources

* [Cargo Book](https://doc.rust-lang.org/cargo/index.html)
* [Compiler Error Index](https://doc.rust-lang.org/error-index.html)
* [Edition Guide](https://doc.rust-lang.org/edition-guide/index.html)
* [The standard library](https://doc.rust-lang.org/std/index.html)
* [rustc Book](https://doc.rust-lang.org/rustc/index.html)
* [rustdoc Book](https://doc.rust-lang.org/rustdoc/index.html)
* [Looking for a deeper understanding of PhantomData](https://users.rust-lang.org/t/looking-for-a-deeper-understanding-of-phantomdata/32477/4)
* [High Assurance Rust](https://highassurance.rs/)


### Application building

* [Command Line Book](https://rust-cli.github.io/book/index.html) - Command line application building
* [Embedded Book](https://doc.rust-lang.org/embedded-book) - Rust for Microcontrollers/embedded systems
* [WebAssembly Book](https://rustwasm.github.io/docs/book/) - Building browser-native libraries with WebAssembly
* [The Little Book of Rust Macros](https://veykril.github.io/tlborm/introduction.html)

### Learning specific topics

Some blog posts to learn about specific topics.

* [Peeking inside trait objects](https://huonw.github.io/blog/2015/01/peeking-inside-trait-objects/)
* [Pinning in plain English](https://blog.schichler.dev/pinning-in-plain-english)
* [Phantom Types in Rust](https://www.greyblake.com/blog/2021-10-11-phantom-types-in-rust/)
* [How not to learn Rust](https://dystroy.org/blog/how-not-to-learn-rust/)


### Articles and Talks

Of course I cannot list all talks on Rust here, so only really interesting/good
ones are listed here.

* [Things I Learned (TIL) - Nicholas Matsakis - PLISS 2019](https://www.youtube.com/watch?v=LIYkT3p5gTs)
* [Responsive Compilers - Nicholas Matsakis - PLISS 2019](https://www.youtube.com/watch?v=N6b44kMS6OM)
* [Stop Whining about Rust Hype - A Pro-Rust Rant](https://thenewwazoo.github.io/whining.html)
* [Monitoring Rust web applications with Prometheus and Grafana](https://romankudryashov.com/blog/2021/11/monitoring-rust-web-application/)
* [Writing dockerfile in rust project](https://windsoilder.github.io/writing_dockerfile_in_rust_project.html)
* ["Type-Driven API Design in Rust" by Will Crichton](https://www.youtube.com/watch?v=bnnacleqg6k)
* [Working with signals in Rust - some things that signal handlers can't handle](https://www.jameselford.com/blog/working-with-signals-in-rust-pt1-whats-a-signal/)
* [Jeffrey Olson, "Functional Programming in Rust"](https://www.youtube.com/watch?v=CSk_QRE7GKg)
* [Unbuffered I/O Can Make Your Rust Programs Much Slower](https://era.co/blog/unbuffered-io-slows-rust-programs)
* [Why is my Rust build so slow?](https://fasterthanli.me/articles/why-is-my-rust-build-so-slow)
* [Things I hate about Rust, redux](https://blog.yossarian.net/2022/03/10/Things-I-hate-about-Rust-redux)
    * [hackernews thread](https://news.ycombinator.com/item?id=30627667)
* [Fast Rust Builds](https://matklad.github.io//2021/09/04/fast-rust-builds.html)
* [Rust by Practice](https://practice.rs/why-exercise.html)
* [A shiny future with GATs](https://jackh726.github.io/rust/2022/05/04/a-shiny-future-with-gats.html)
* [Bugs that the Rust compiler catches for you](https://kerkour.com/bugs-rust-compiler-helps-prevent)
* [How I speeded up my Rust builds on GitHub ~30 times](https://ectobit.com/blog/speed-up-github-actions-rust-pipelines/)
* [(async) Rust doesn't have to be hard](https://itsallaboutthebit.com/async-simple/)
    * [hackernews](https://news.ycombinator.com/item?id=31611456)
    * [reddit](https://www.reddit.com/r/rust/comments/v44tp2/async_rust_doesnt_have_to_be_hard/)
* [Rust without the async (hard) part](https://lunatic.solutions/blog/rust-without-the-async-hard-part/)
    * [hackernews](https://news.ycombinator.com/item?id=31681373)
* [Writing Rust the Elixir way - 18 months later](https://lunatic.solutions/blog/writing-rust-the-elixir-way-1.5-years-later/)
* [ZeroMQ Communication Between Python And Rust](https://aimlesslygoingforward.com/blog/2017/03/18/zeromq-communication-between-python-and-rust/)
* [Trivia About Rust Types: An (Authorized) Transcription of Jon Gjengset’s Twitter Thread](https://www.thecodedmessage.com/posts/trivia-rust-types/)
    * [hackernews](https://news.ycombinator.com/item?id=31652363)
* [Why Rust easily optimizes out smart pointers where C++ cannot? (hackernews)](https://news.ycombinator.com/item?id=31626508)
* [Lessons from my marathon Rust debugging session](https://www.leafwing-studios.com/blog/debugging-lessons/)
* [Why Rust](https://www.rerun.io/blog/why-rust)
* [Memory Safe Languages in Android 13](https://security.googleblog.com/2022/12/memory-safe-languages-in-android-13.html)
    * [discussions](https://discu.eu/q/https://security.googleblog.com/2022/12/memory-safe-languages-in-android-13.html)
* [How much does Rust's bounds checking actually cost?](https://blog.readyset.io/bounds-checks/)
    * [discussions](https://discu.eu/q/https://blog.readyset.io/bounds-checks/)
* [Rust in 2024 (Niko Matsakis)](https://www.youtube.com/watch?v=OuSiuySr6_Q)


## Libraries

* [clap](https://clap.rs) - State of the art commandline interface building and parsing
* [opentelemetry-rust](https://github.com/open-telemetry/opentelemetry-rust)


## Tooling

* [roogle](https://roogle.hkmatsumoto.com/)
* [cargo-sonar](https://hole.tuziwo.info/cargo-sonar.html)
* [Checking Unused Dependencies in a Rust Project with Github Actions](https://erayerdin.com/checking-unused-dependencies-in-a-rust-project-with-github-actions-ckwm3yov901cwlvs1h48z54xi)
* [cargo-vet](https://mozilla.github.io/cargo-vet/)
* [rustexplorer](https://www.rustexplorer.com/b/about)
* [Ther Kani Rust Verifier](https://model-checking.github.io/kani/)
* [cargo-supply-chain](https://github.com/rust-secure-code/cargo-supply-chain)
* [cargo-feature-set](https://lib.rs/crates/cargo-feature-set)


## Notes

---

The Rust standard library actually optimizes zero-size-type allocations away,
for example
[here](https://github.com/rust-lang/rust/blob/866335b337964c79372cd6b1b1213f168efd311f/library/alloc/src/raw_vec.rs#L188),
allocations are prevented if the generic type `T` is zero sized.

Thus, the following code will never allocate after the first allocation:

```rust
let _ = std::iter::repeat(()).collect::<Vec<()>>();
```

It does still panic, though, because the element counter overflows.

---