News for hackers. Stuff that matters.
Re:“Clean Code, Horrible Performance” Discussion by bart_spoon on Saturday March 11, 2023 @08:05PM (#35115063)
How are structs in Rust any different than classes?
Re:“Clean Code, Horrible Performance” Discussion by hdhrufjdi on Sunday March 12, 2023 @01:14AM (#35117276)
Behavior and data is more separated

A struct only contains data, however you e.g. can define methods on it or implement traits for it No inheritance.

Re:“Clean Code, Horrible Performance” Discussion by bart_spoon on Sunday March 12, 2023 @09:21AM (#35119756)
They don’t only contain data though, you can define methods as you said. Yes, there is no-inheritance, but they contain data, maintain state, and allow for defined methods. 90% of the time people are talking about classes, they are talking about that.