Live data from Hacker News

Exercises to Learn Rust

rust-exercises.com

71–80 of 129 posts

Re: Exercises to Learn Rust

#71
post #51

Surprised no one has mentioned another great and similar resource called Rustlings [0] (yes very punny name). You are given some files with todo statements which you'll need to fix and make the code compile and pass all the tests. It's an interactive way to learn which is what got me through learning Rust a few years ago. [0] https://github.com/rust-lang/rustlings

The difference is that Rustlings requires the person to already know Rust whereas the link on this post (100 Exercises to Learn Rust) starts teaching Rust from the basics (assuming that the person knows another language).

I think Rust is close enough in syntax to C and Java so that just about any adept programmer can figure it out.

Re: Exercises to Learn Rust

#72
post #50
post #37

Earlier quoted context omitted.

You get ridiculous performance gains with Rust a web backend. Even Microsoft is rewriting part of their C# backend to Rust on the 365 application side of things. Which is where you get to deal with the hefty ms-graph api which handles literal fucktons of data. Anyway. It is more verbose than something like Go or Python. I’m not sure it’s really so bad compared to most languages, but some of the benefits you get from…

Office team never was a big .NET fan, and they were partially responsible for Longhorn's failure, see also Hilo C++ tutorial made by the team as part of Vista SDK tutorials, or their love for Webwidgets to C++ code, so that isn't that surprising. It isn't as if C# vlatest wouldn't be able to take up the task, Bing, XBox game servers, and other large scale services are fully on .NET.

[deleted]

Re: Exercises to Learn Rust

#73
post #53

Earlier quoted context omitted.

> Pavex is in beta, so you need to activate Pavex with an activation key: > You can retrieve an activation from the Pavex Discord server’s #activation channel after you’ve joined the beta on Pavex.dev.

To be fair, he did say it was "pretty novel"...

Nitpick but a project can be finished and feature complete and still be "pretty novel in how it works". The solution is what's novel in that sentence.

Re: Exercises to Learn Rust

#74

This looks like a great resource! https://rust-exercises.com/03_ticket_v1/07_setters This shows why I wouldn't use Rust for anything. Seems like a lot of verbosity for gains that don't really apply whatsoever for the kind of work I do (web apps and APIs). You have to remember let/mut fine, but then ownership/borrowing, and finally this `into()` thing - yuck! Like washing your face with sandpaper.

`into()` just converts something from one type to another, like an integer to a floating point number. Would you have liked for such conversions to happen implicitly? Because let me tell you, that is one of the most painful features of C++, and modern well-written C++ typically disables implicit conversions in one way or another.

(Note: For the specific example of integer-to-float, Rust has an alternative built-in syntax, but `.into()` is the canonical way that also works in generic code.)

Re: Exercises to Learn Rust

#75

Experienced Rust users: how do you rate this? What level of proficiency would this leave you with

I'm not very experienced, but by skimming the headings I can see that it covers almost all of Rust's core features. I'd say you're between a beginner and an intermediate Rust user if you complete the exercises and can be comfortable dealing with lifetimes.

Re: Exercises to Learn Rust

#76

This is quite interesting! While we're on the topic, does anyone know of a similar set of exercises for learning Golang?

Go by example is an established favorite. https://gobyexample.com/

Have been using go for 8 years now, and started with this. And to be quite honest, I still refer to this sometimes for quick lookup on certain things related to syntax, pools, waitgroups or channels. Beautifully done tutorial of Golang, can be done in a few hours and gets you a good base knowledge of the language.

To the creator, a sincere thank you!

Re: Exercises to Learn Rust

#77
post #7

Worth noting that this set of exercises was created by the author of "Zero to Production in Rust", the well-reviewed book with the crab-in-a-human-skull cover[1]. [1]: https://www.zero2prod.com

> crab-in-a-human-skull cover Anyone know the story behind this?

Author here!

To be fair, there is no particular backstory. I picked a hermit crab as the book logo since crabs are strongly associated with Rust due to Ferris, Rust's mascot. I then landed on that style (and the skull) because they looked sick and distinctive. The cover images of many technical books are incredibly dull these days.

Re: Exercises to Learn Rust

#78
post #53

Earlier quoted context omitted.

Also the same one who is making a new web server framework for Rust called Pavex, which is apparently pretty novel in how it works compared to others like Actix Web and Axum [0][1]. [0] https://www.lpalmieri.com/posts/a-taste-of-pavex-rust-web-fr... [1] https://blog.logrocket.com/using-pavex-rust-web-development/

> Pavex is in beta, so you need to activate Pavex with an activation key: > You can retrieve an activation from the Pavex Discord server’s #activation channel after you’ve joined the beta on Pavex.dev.

Open beta is coming! A few more months of polishing, and then I'll open the floodgates.

Re: Exercises to Learn Rust

#80

Earlier quoted context omitted.

Ownership is not implementation. Ownership is contract. If you’re an owner of a house you can do more than if you’re only renting and if you’re renting you can do more than if you’re only looking at the house from the street. Ownership is a very useful concept that influences interfaces in real life so why wouldn’t it in programming?

This reads like the Rust equivalent of the OOP 'animal/cat/dog' intros of yore. Real world comparisons are almost never all that helpful when it comes to computing concepts.

Ok, point taken, indeed it reads like that. However, in programming and generally in engineering this is a very useful concept. There is a difference between "component X is part of Y" than "component X works / interacts with Y" or "component X has exclusive access to Y in this particular span", similarly how it is often very important to know if "component X can be safely shared" - and Rust allows to express that, while languages like Java are quite blind to that.

Consider a simple Java method signature:

    public static MyCustomFileReader open(FileHandle someFile) { ... }
Who is responsible for closing the file after you're done with reading it? Does the returned reader close the file handle on close, or should I issue another close on the file handle afterwards? Can I open multiple readers on the same file? The only way to know is to check the javadoc comment, if someone took time to write it. In Rust there are no doubts like that.
Post reply on HN