Live data from Hacker News

A half-hour to learn Rust

fasterthanli.me

1–10 of 150 posts

Re: A half-hour to learn Rust

#5
Numbers could also be differentiated in Rust. For example, to make sure your "16" is an i32 you could write

> let x: i32 = 16i32;

Otherwise, it's a very comprehensive article. The only missing parts are the async/await keywords and the sync primitives (like Mutexes/RwLocks).

Re: A half-hour to learn Rust

#6
post #3

Only, it’s more one hour and a half rather than half an hour. Excellent quality stuff nonetheless

It's only an half an hour if you are familiar with these concepts (generics, traits, pattern matching, error propagation, etc...). Some concepts are exclusive to Rust (lifetimes/ownership), so I doubt you can get it in 30 minutes if you have never written code in Rust before.

Re: A half-hour to learn Rust

#7
post #5

Numbers could also be differentiated in Rust. For example, to make sure your "16" is an i32 you could write > let x: i32 = 16i32; Otherwise, it's a very comprehensive article. The only missing parts are the async/await keywords and the sync primitives (like Mutexes/RwLocks).

You don't need both of those "i32"s. Rust has type inference, so you can just write either `let x = 16i32` or `let x: i32 = 16`.

Re: A half-hour to learn Rust

#8
post #5

Numbers could also be differentiated in Rust. For example, to make sure your "16" is an i32 you could write > let x: i32 = 16i32; Otherwise, it's a very comprehensive article. The only missing parts are the async/await keywords and the sync primitives (like Mutexes/RwLocks).

You don't need both of those "i32"s. Rust has type inference, so you can just write either `let x = 16i32` or `let x: i32 = 16`.

I use it mostly if I'm passing arguments to another function. It serves as some sort of code documentation.

> my_function( 44i32 );

That makes it clear from the code that function accepts an i32 and not any number.

Re: A half-hour to learn Rust

#9
I found this extremely helpful. I’ve always been interested in Rust but never got around to it cause most of the source code I’ve read on GitHub was overwhelming. This is a nice walkthrough to get someone like me interested. Great work!
Post reply on HN