In Rust, we can compare if two struct instances are equivalent and whose respective field values are the same. However, doing so requires using traits. Equivalent vs. Partial Equivalent Before we proceed, let us differentiate between Equivalent and Partial Equivalent.
Function Accepts Struct That Implements A Trait
This post briefly talks about how to create functions that accept struct instances that implement a specific trait.
Vec With Specific Trait Type
In this post, we want to create a Vec instance that only accepts struct instances that implements a particular trait.
Custom Data Types With Struct, Trait, And Enum In Rust
We can create custom data types in Rust using struct, trait, and enum. A struct is a composite data type that groups variables in a memory block. These variables are then accessible via the struct’s instance – also referred to