Hello HN, I've recently started learning Rust, and I'm finding it incredibly interesting! However, I'm also encountering a wealth of new syntax, built-in functions, and concepts that are unique to Rust. To solidify my understanding and create a useful resource for myself (and hopefully others), I've been diligently documenting these discoveries. I've decided to share these insights by starting a blog, where I'll delv…
If you think any of the features you listed are unique to Rust, you need to learn more languages.
Idiomatic Rust
21–30 of 45 posts
Re: Idiomatic Rust
#22Re: Idiomatic Rust
#23> Idiomatic Rust Not very idiomatic to not use the builtin code formatter...
Re: Idiomatic Rust
#24Don't be let down by other comments. The topic itself something I think people would more enjoy when it is more comprehensive. Add more content with your findings, refine and then post again on HN
Re: Idiomatic Rust
#25The technical arguments for one or the other option are available in a bunch of places, but no good guidance on an idiomatic default.
Re: Idiomatic Rust
#26 Rust
simplifies
numerical
variable
initialization
by
allowing
type
annotation
directly
within
the
value
assignment.Re: Idiomatic Rust
#27Is x = 57u8 actually idiomatic when compared to x: u8 = 57? I don't remember any Rust resource using that.
It's not only not really idiomatic, it's almost never necessary in practice. I was struggling to think of a time I'd ever given a type annotation to an integer local variable - because normally the place the variable ends up dictates the type. Local variable becomes part of struct? Struct dictates type. Passed into function? Function dictates type. Multiplied by other variable and then that is passed to function? The…
Re: Idiomatic Rust
#28Please do Strings next. Effective Rust isn't useful at guiding to a good default. The technical arguments for one or the other option are available in a bunch of places, but no good guidance on an idiomatic default.
Re: Idiomatic Rust
#29The "Effective Rust" book was recently published and can be read online, for free [1]. I'd go as far and say that all of it is, by definition, idiomatic. I guess I'm saying, you could reasonably change the book's title to "Idiomatic Rust". I'd read that first and then look into what bits it doesn't cover. That could be worth a blog like the one this is about. [1] https://www.lurklurk.org/effective-rust/
Re: Idiomatic Rust
#30only one part. applies to zero of the rust code i write. formats horrendously on mobile. you gotta work on this more before putting it on hacker news