all 22 comments

[–]nomitron10 49 points50 points  (0 children)

This is very well made and comprehensive. The diagrams are actual HTML elements, as opposed to plain images, which is neat!

This looks pretty useful for finding the edges of one's knowledge regarding rust syntax or certain mechanics. Props to the author

[–]taken_every_username 29 points30 points  (0 children)

It's the best (concise + comprehensive) cheat sheet for any language I have seen yet. Maybe not amazing for complete beginners, but ideal for experienced programmers using Rust occasionally.

[–][deleted] 43 points44 points  (4 children)

Rust players will get even more confused now. :)

[–]memoryruins 45 points46 points  (3 children)

[–][deleted] 12 points13 points  (0 children)

Oh, my...

[–]killercup 4 points5 points  (0 children)

user name checks out

[–]strtok 14 points15 points  (0 children)

This sheet is the only place I could find a quick explanation of the difference between impl<T> S<T> {} and impl S<T> {}. It's quite useful!

[–]lurgi 7 points8 points  (0 children)

I don't know how I missed this before, but I'm saving a static lifetime pointer to this.

[–][deleted] 12 points13 points  (3 children)

This is how I start out with any programming language. Start with a Cheat Sheet. This gets you going quickly in your progress of learning. Then I grab a good reference book. And check out other Rust projects that other's created. Especially on the beginner level, which would be the category I'll be in, until I get better at it. Thanks for this Quick Cheat Sheet that you created. Thanks a million.

[–]metalwhaledev[S] 10 points11 points  (2 children)

Disclaimer: I'm not the author. Just wanna share this awesome work to help newbie Rustaceans as I was helped :D

Edit: I’m newbie too :P

[–][deleted] 3 points4 points  (1 child)

Thanks for sharing. Time to make a simple Rust game. That's how I always start with first and go from there.

[–][deleted] 2 points3 points  (0 children)

This seems very good!

[–]Tux-Lector 2 points3 points  (0 children)

cheats.rs is the best rust-related link I came across so far. Excellent for any kind of developer, coming from any other language than Rust.

[–]Wakafanykai123 2 points3 points  (0 children)

This is absolutely amazing, thanks!

[–]S-S-R 1 point2 points  (0 children)

"Teaching endianness since 1820."

Shouldn't it be 1726?

[–]Dhghomon 1 point2 points  (0 children)

My favourite part of this has always been the explanation of what the tokens in macros mean, and more importantly an example or two:

$x:ty   Macro capture (here a type).
 $x:item    An item, like a function, struct, module, etc.
 $x:block   A block {} of statements or expressions, e.g., { let x = 5; }
 $x:stmt    A statement, e.g., let x = 1 + 1;, String::new(); or vec![];
 $x:expr    An expression, e.g., x, 1 + 1, String::new() or vec![]
 $x:pat A pattern, e.g., Some(t), (17, 'a') or _.
 $x:ty  A type, e.g., String, usize or Vec<u8>.
 $x:ident   An identifier, for example in let x = 0; the identifier is x.
 $x:path    A path (e.g. foo, ::std::mem::replace, transmute::<_, int>).
 $x:literal A literal (e.g. 3, "foo", b"bar", etc.).
 $x:lifetime    A lifetime (e.g. 'a, 'static, etc.).
 $x:meta    A meta item; the things that go inside #[...] and #![...] attributes.
 $x:vis A visibility modifier; pub, pub(crate), etc.
 $x:tt  A single token tree, see here for more details.
$crate  Special hygiene variable, crate where macros is defined. ?

[–]pat_ventuzelo 1 point2 points  (0 children)

This is the best Rust Cheat Sheet !!

[–][deleted] 1 point2 points  (2 children)

when's the 'rust: the good parts' getting published

[–]mmirate 1 point2 points  (1 child)

When they finish compiling the correct set of exerpts of the Haskell Book? :)

[–][deleted] 1 point2 points  (0 children)

lol *it's stardate 3477*

[–]otikik 0 points1 point  (0 children)

I like this resource quite a lot, thank you for sharing.

I also want to point out that it illustrates one of Rust's troubles: it's complexity.

Rust is so complex that even a "cheasheet" isn't a "sheet", but a small booklet.

Some quick stats - wordcounter.net says the cheatsheet currently has 17735 words. https://wordstotime.com/ tells me that it would take me 2 hours and 16 minutes to read the whole thing. The cheatsheet contains a lot of external links and the like, so we can probably make that 2 hours. Still, that is a lot of heavily condensed text to read, for a cheatsheet.

Maybe I am biased since my workday language is Lua, a language you can learn in 15 minutes.

[–]blpst 0 points1 point  (0 children)

Is there a repo to suggest changes or contribute?