What topics would you like to see covered in a video course about Rust?


#1

I’m starting to develop a video course about Rust aimed at people already comfortable with the basics of the Rust language. I want it to actually be useful for Rust programmers, so I need your help determining what I should focus on.

Rust has quickly become my favorite programming language, so I’m really excited to give back what I have learned and help grow the community. :smile:

Please let me know in the replies below, on Twitter, or via email:

  • If you’re a Rust beginner, what intermediate/advanced topics do you wish you knew more about?
  • If you already know some Rust, what topics do you wish were covered better or talked about more?

Think about the kinds of questions you ask yourself or other people about Rust.


Here’s a short list of some things I had in mind to get you started:

  • expressing things using Rust’s type system (going from OOP to an algebraic type system)
  • dealing with ownership and understanding why the compiler is complaining about your code
    • fencing with the borrow checker vs. fighting it
  • fearless concurrency and what we mean by that
    • different approaches to parallelism in Rust: futures, tokio, mio, etc.
  • Rust on the web - servers, validation, serialization (serde), etc.
  • macros: custom derive vs. traditional macros
  • safe vs unsafe Rust

There’s so much more that could be covered! Please let me know! :slight_smile:

Edit: Thank you everyone!! I’m really thrilled to see all the interest in my course! :smile: :smile:

If you would like to know when the course is completed, please fill out this form. I will personally send you an email and let you know as soon as it is ready. Your information won’t be shared with anyone.


#2

When I began learning Rust, I noticed a sharp increase in my productivity as I became familiar with common features of the standard library. Specifically, learning about the Iterator trait, Option::map, and Deref coercions. So, I think a topic simply on the standard library would be great.


#3

+1 for Serde! :grin: Open an issue or send an email if you would like me to review any Serde content you put together.


#4

Error handling would be nice. The different strategies for dealing with errors and any advice on ways to make them play nice together. For instance when a few crates you use handle errors in different ways (e.g. boxed vs. non-boxed, traits vs. values), how do you ergonomically integrate that with your own code and strategy.


#5

So actually one topic, quite rarely I’ve seen discussed in a good and comprehensive explanation of when, why and how to use interior mutability with good examples for each case. When to use Box<RefCell<T>> and the rest.


#6
  • How not to write yet another linked list or tree — Rust is not particularly good for that, so better use an existing crate
  • How to realize that throwing around <Rc<RefCell<_>>s packed in Vecs is not a proper solution when you can’t figure out your ownership, and what to do instead
  • That Rust is not “batteries included” and that people should look for existing crates instead of implementing anything they can’t find in stdlib themselves (with lots of unsafe). Examples such as self-referencing.
  • How to design a library to be as zero-cost (and thus fast) as is the rest of the Rust ecosystem, what to look for.
  • How to use existing tooling (cmake, gdb, …) with Rust.

#7

(I already know Rust. )

I’d like to learn more about Futures, especially for CPU-bound tasks, not just async I/O. I’ve found tutorials about using/consuming Futures, but not much about creating them/building interfaces based on them.


#8

Count me as curious about this as well. My current understanding of the Tokio future model is that it is a wonderful fit for networked IO on UNIX-like platforms (which it was designed for), as it maps directly to the underlying epoll/kqueue system abstraction, but could be less well suited to tasks which do not fit the “polling event loop + on-demand processing” model very well such as parallel computation. I’d be glad to be proven wrong on this point.


#9

About Rust specific types like: Rc, Arc, RefCell, Mutex - about use cases and hints to figure out when to use a particular type.


#10

Thank you so much for the interest everyone! Please keep the responses coming! I am reading and recording every single one and will try to fit in as much as possible. I’m thrilled to see all the interest and can’t wait to get started on this!

If you’d like to be notified about when the course is ready, I’ll personally send you an email if you fill out this form. Your information won’t be shared with anyone else.


#11

+1 for “Tokio/Futures for dummies”.


#12

(I know very little Rust)

  • Demonstrating the use of Result and Option for error handling. This was by far the best section of the original Rust book and it’d make a great video.
  • What’s going on in memory when I do something in Rust - allocations on the heap etc. With pictures! And animation!

#13

Not really a topic, but I would love to see some real life application being built bit by bit over the video course.


#14

I’ve been programming using Rust for a while now, but my use a Rust has been rather constrained to the problem space of the one crate that I’m working on (encoding_rs). I don’t find the usual tropes of what’s supposed to be hard about Rust hard: I don’t find the distinction between String and &str hard (and I think it would be harmful to try to obfuscate the distinction for supposed benefit of beginners) and I don’t find lifetimes conceptually hard. (Of course, like everyone else, I have had practical problems with expressing syntactically the lifetimes that I knew I wanted conceptually and I have spent time fighting the borrow checker structure code such that mutable double borrows don’t occur. Still, anyone who has programmed with C or C++ has to understand lifetimes conceptually or they have been routinely writing security bugs unless saved by luck.)

What I’ve found hard includes:

  • How to navigate the docs in the presence of deref conversions and functionality being behind iterators and such: Figuring out what methods I can actually call on a given struct. Example case: I have a slice. What documentation reading routines should I have to figure out the standard library way of linearly searching the slice for a key in getting the index? I can see binary search on the slice itself but no linear search. The answer is that I need to take an iterator over the slice and call a method on the iterator: haystack.iter().position(|&x| x == needle)

  • While Rust doesn’t have method overloading by parameter list, traits such as FromIterator lead to an outcome that gives the ergonomics of overloading by return type. Although I know that the FromIterator, From and Into traits exist, I have a hard time developing intuition about their use and intuition about defining similarly used traits myself. Seeing more examples of putting them into practice than (the current draft of) the Programming Rust O’Reilly book gives for these would be helpful.

  • The previous point of traits enabling the ergonomics of overloading by return type can be used to emulate the ergonomics of method overloading by parameter type. I don’t know how one would teach it, but it would be useful to teach when to use that trick. (See how the nsstring crate in Gecko has an append method that has specialized behavior when the argument is another XPCOM string even though XPCOM strings deref into slice and the method accepts slices, too.)

  • Figuring out lifetime syntax when there’s a group of interrelated structs that have lifetime interdependencies. (I knew conceptually what I wanted for handles.rs in encoding_rs but had to ask on IRC for the syntax.)


#15

In general, I would add that it can be hard for a newcomer to get acquainted with the “standard” Rust traits, and choose which should be implemented for a new type. It would perhaps be beneficial for some documentation to provide a “trait glossary” which summarizes in a sentence or two what each of these standard traits does.


#16

You may find this useful: https://llogiq.github.io/2015/07/30/traits.html

I do agree that something like the above would be useful in the official Rust documentation.


#17

Agree this is a great post by @llogiq and it should be easily discoverable. It is linked from rust learning, but it may be useful enough that something derived from it would be appropriate for the official documentation.

cc @GuillaumeGomez @steveklabnik


#18

The best thing to do might be to open an issue now so we can discuss how to write it. :slight_smile:


#19

Yes, thank you, this is exactly the kind of thing which I had in mind. The only “common” traits which I can think of right now that this post is missing are the in-place variants of arithmetic operators (AddAssign, MulAssign, etc.).

And I agree with everyone else that this would have its place in the official Rust documentation. @GuillaumeGomez, in which repo should such a documentation issue be opened and discussed? rust-lang/rust on Github?


#20

Yes, this one. Thanks!