Type Alias in Rust

Rust is rich in sense of types. You can create your own structs and use generics. Rust even allows you to create a type alias. IMHO type alias is useful for 2 reasons. The first type alias makes the code more readable since the type alias can make the intention more clear. The second and less obvious is when you have generics because you can use the type alias to hide or save typing a big generic expression. However, this is a double edge-sword, at the same time is pretty useful to avoid typing and make the type construct proper it really could be hiding some unnecessary complexity. I have a video showing type alias in action. So let's get started.


The Video


The Code


Cheers,
Diego Pacheco

Popular posts from this blog

C Unit Testing with Check

Having fun with Zig Language

HMAC in Java