this post was submitted on 19 Jan 2024
17 points (94.7% liked)
Rust
6049 readers
42 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Hey, you're on a similar path to me. I've been on a Rust job for the past year.
Being a general-purpose programming language Rust can be used in a lot of contexts. The work I'm doing is all API server stuff, which I'm sure you already have a solid background in. There are some niches where Rust stands out that might be worth studying depending on your interest, but none of these are essential to Rust work generally.
nostd
, and learning about controlling hardware.You switched to Rust from other language? I think what I would really like to know deep knowledge about Rust do you need to make the switch. I read the whole book and did a deeper investigation about the main features for a talk about Rust in my company. I've spend some time reading about the ideas behind type classes, algebraic types, memory safety and others and how it compares to other languages. But that's pretty much it. Is there anything else you need deeper understanding of? What are they asking about during interviews?
Oh right, there are some particular things that are helpful for a deeper language understanding.
Type classes and algebraic types are for sure standout features of Rust that make it better than most languages. Much of my experience before Rust was Typescript, but I have some background in Haskell so I was fortunate to have a head start on these concepts. I haven't done any Rust interviews - my current role switched from Haskell to Rust after I joined. So I don't know what interviewers are asking.
None of the prior languages you listed use manual memory management (which was the same for me). And even if you have that background, Rust does some things differently. (Although from what I understand explicitly codifies a number of ideas that experienced C++ devs have in their heads as "good practice".) I think you'll want to study up on how memory works. One of my favorite resources for this is Logan Smith's Youtube channel. Those videos get me thinking about how this stuff I take for granted really works. The first two Rust videos on there, Use Arc Instead of Vec and Choose the Right Option are good ones to watch. Even if you opt not to use
Arc<[T]>
orBox
it's useful to understand how those differ fromVec
andString
.Closures are weird in Rust, and are worth understanding. You have to choose between
Fn
,FnMut
, andFnOnce
. Plus there is themove
keyword. I love the post Finding Closure in Rust for explaining what's going on there. (It takes the implement-your-own-version approach which is a genre where I've incidentally seen some other gems, like Implementing a simple Promise in Javascript, and The Git Parable for understanding how git really works.)Another area that is helpful to study is Rust's implementation of
async
. It is similar toasync
as you've seen it before, but also different. For example in Javascript when you call an async function like, say,fetch
it dispatches network requests right away. But in Rust aFuture
does not do anything until you callawait
on it. Learning aboutasync
leads into understanding of some more general language features. At the shallower end you learn about functions that return types based on trait, likeimpl Future
orBox>
because Future types often can't be named directly so you have to describe what trait they implement instead. (This is very similar to how you work with functions that return closures.) At the deeper end you learn about working withPin
. You can get a deep dive on that in Pin and suffering by fasterthanlime. All of that guy's posts are useful, but they are deep plunges so it can take some motivation to read them.Since I seem to be recommending people to learn from I'll add Mara Bos' blog. She's the Rust Library team lead. Her blog gets into some of the nitty-gritty stuff that gets you thinking about the language on a deeper level. She also wrote a book recently, Rust Atomics And Locks. I haven't read it yet, but it looks useful.
Thanks a lot, exactly what I was looking for. Those resources look very interesting and I definitely will check them out.