summaryrefslogtreecommitdiffstats
path: root/computer/programming/rust.md
blob: 5c45633e5357d737cbb14198b65755a40bcb87ba (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
---
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


### 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)


### 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)


## Libraries

* [clap](https://clap.rs) - State of the art commandline interface building and parsing


## 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)


## 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.

---