logoalt Hacker News

Deflettertoday at 6:04 PM2 repliesview on HN

Something that I don't understand about Rust, or these rustylangs, is the insistence of separating structs and methods. Don't get me wrong, I like named-impl blocks, but why are they the only option? Why can't I put an unnamed-impl block inside the struct? Or better yet just define methods on the struct? What's the point of this and why do these rustylangs never seem to change this?


Replies

phplovesongtoday at 6:33 PM

Dunno. Impl block are very similar to Go methods. I dont think one if better than the other.