Michael Krisher
4 min readFeb 9, 2024

Rust Structs compared to Ruby classes

Wait, the title says we are comparing Structs and classes, but Ruby has a Struct object, what gives? It does, we’ll get into it.

Photo by Ricardo Gomez Angel on Unsplash

If you’ve been following along, we haven’t gotten into code structure yet. We’ve scratched the surface of classes and objects in the last post about Enums but in this post, we’re going to lay out the foundation of “classes” in Rust compared to Ruby.