little_ferris@programming.dev to Rust@programming.devEnglish · edit-24 months agoWhat are some mind blowing Rust tricks?message-squaremessage-square20fedilinkarrow-up10arrow-down10file-text
arrow-up10arrow-down1message-squareWhat are some mind blowing Rust tricks?little_ferris@programming.dev to Rust@programming.devEnglish · edit-24 months agomessage-square20fedilinkfile-text
If we were to create a Rust version of this page for Haskell, what cool programming techniques would you add to it?
minus-squareEphera@lemmy.mllinkfedilinkarrow-up0·4 months agoThis works with anything that one might call “named tuples”. So, you can also define a struct like so and it’ll work: struct Baz(i32); On the other hand, if you define an enum variant with the normal struct syntax, it does not work: enum Foo { ... Qux { something: i32 } //cannot omit braces }
This works with anything that one might call “named tuples”.
So, you can also define a struct like so and it’ll work:
struct Baz(i32);
On the other hand, if you define an enum variant with the normal struct syntax, it does not work:
enum Foo { ... Qux { something: i32 } //cannot omit braces }