317
Learning to program in rust
(programming.dev)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
This was my experience too, until I learned a few things.
Box
,dyn
, andRc
.dyn
) isn't really necessary a lot of the time. Identify where you absolutely need it and solve everything else through other means.&
). Instead, try to re-think your structs and functions using composition and clone/copy instead. It's less efficient, but it's easier to optimize a running program, too.enum
,match
,if let
, and?
are weird, but are where you get the most leverage in the language. Try to master them.derive[...]
is a first-class feature with a lot of standard lib support. Always use this to make your custom types mesh with the standard lib more seamlessly.if
andmatch
are expressions, not statements! You can use either block to evaluate to a single value, useful in composite expressions likelet
. Example;let x=if y>20 { y } else { 0 };
Or use them to return values from functions (w/o need of a return statement).