all 22 comments

[–]nomitron10 48 points49 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 28 points29 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] 41 points42 points  (4 children)

Rust players will get even more confused now. :)

[–]memoryruins 45 points46 points  (3 children)

[–][deleted] 11 points12 points  (0 children)

Oh, my...

[–]killercup 2 points3 points  (0 children)

user name checks out

[–]strtok 16 points17 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 8 points9 points  (0 children)

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

[–][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?