Best ways to learn Rust custom types

Hello all!

Never really worked with languages that allow custom types, implementations, and traits (like Rust does) This feels like a very big thing in Rust, or maybe i'm wrong on that? Platforms like Codewars and Leetcode are great ways to learn how to interact with the common data types out there. But they seem to be negligible when it comes to learning custom types, implementations, traits, etc.

As someone who doesn't work in programming and lacks historical experience with these types of concepts. What is a good way to learn and practice these repeatedly?

Thanks all!

Tbh, I believe that only experience can make you really appreciate a type system as powerful as the one found in Rust. Let me explain:

I have watched several professional frontend developers/content creators suggesting their audience NOT to type things like function return types, among other recommendations that quickly trigger my anxiety :sweat_smile:.

This also reminded me of the times when I was learning to code in JavaScript and was reluctant of the benefits that Typescript could even provide.

So, in essence, the process of learning to value a type system is one that is all about pain: You'll never learn the lesson unless you have suffered from what the type system was trying to protect you from.


I quite doubt that you've never worked with languages that allow custom types. For example, if you've used Python (like many beginners do), then that would not be the case (the right search keyword is "classes" in this case). More likely, you didn't learn about your previous programming languages' type definition capabilities.

The trait system, on the other hand, is quite different from the OOP approach of languages like Python (and more akin to typeclasses in Haskell, but if you are a beginner I doubt you know Haskell).


Almost all mainstream languages offer custom types and interfaces. Most OOP languages have classes and interfaces or abstract classes (Java, C#, C++), but even plain old C has structs. Haskell's type classes are almost a direct equivalent to generics and traits. Even TypeScript allows simulating type definitions over plain JavaScript objects (and thinking about it, JavaScript itself allows prototypes to be user-defined constructor functions).


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.