Earlier quoted context omitted.
This is why I'm glad we have both; I don't think one resource could ever satisfy everyone. Pumped to see Rust in Action getting closer to publication too!
I just bought Rust in Action a couple weeks ago (after having gone up to chapter 11 in the No Starch book). It's definitely good to have both. I'll probably do 1/2 the new book, finish the 1st one and then finish the new one. I did pretty much the same thing with Dave Thomas's Programming Elixir book, bailing halfway through, using a 2nd resource to consolidate, and then returning to finish it. I like learning Rust s…
Rust Language Cheat Sheet
61–65 of 65 posts
Re: Rust Language Cheat Sheet
#62Earlier quoted context omitted.
Oh, my! I have spend countless hours on the web looking for (and successfully finding, of course) cheat sheets for all sorts of languages, but somehow I had never come across this site. This is extremely well done. Thank you,spectramax, for basically revolutionizing my life this morning! :)
Surprisingly, https://learnxinyminutes.com/docs/bash/ is the best resource out there to learn shell scripting. This page basically turned me from a novice who could only write two commands with | or && between them to a competent shell programmer. My shell scripts have functions, descriptive variables, error handling, good formatting, etc.
Add shfmt on top and you are good to go.
Re: Rust Language Cheat Sheet
#63Ralf Biedert, thanks so much for this! I've been learning Rust via the Rust Book for the past few months and this will help so, so much - fantastic work.
I know everyone says how good Rust's documentation is but I tried learning Rust with The Rust Book and found it frustrating: too long and wordy on the easy bits and without useful insight on the hard bits. I ended up buying Programming Rust by Jim Blandy [0] on a recommendation from HN comments and found it must easier to learn from. I'm already familiar with several other languages, which that book assumes, so your…
I don't know about everyone else, but when I say that I'm mostly referring to the auto generated documentation you get from Cargo. One of Rust's greatest strengths is having uniform documentation for every project.
Re: Rust Language Cheat Sheet
#64Earlier quoted context omitted.
> Weird, I thought it was just something like "If it's an expression, use a semicolon otherwise you're returning it". This is a common misconception, but it isn't true. Rust is an expression-oriented language. This means that most things are expressions, and evaluate to some kind of value. However, there are also statements. "Item declarations" (stuff like defining structs, etc) and let statements are the two most co…
TBH I thought it made sense, but I'm still confused on everyone elses description lol. I feel like what you said is what I said, but with more accuracy and depth. Eg, if my block was: { foo(); bar() baz(); } My statement holds true, no? It's obviously a syntax problem, since I'm trying to define a statement after I define an expression (which would be trying to execute code after a return, effectively) . So.. I'm not…
If the last statement/expression in a block is an expression not followed by ;, the block evaluates to that expression. Otherwise (such as, the last expression has a ;), the block evaluates to ().
The function "return" behaviour is because function bodies are blocks: a function returns the value of its block (or any `return`).
Re: Rust Language Cheat Sheet
#65Earlier quoted context omitted.
You’re not alone. I found the Rust book very hard going, whereas Programming Rust was just the right amount of rigor and interesting examples for me.
This is why I'm glad we have both; I don't think one resource could ever satisfy everyone. Pumped to see Rust in Action getting closer to publication too!
Thanks!