Generics are a facility to write code for multiple contexts with different types, and parameterization allows the programmer to write code that makes fewer assumptions about the data structures and code segments involved in the code's definition. For example, a very ambiguous concept would be the concept of addition. When a programmer writes a + b, what does that mean? In Rust, the Add trait can be implemented for just about any type. As long as there is an implementation for the Add trait in scope that is compatible with the types of a and b, then this trait will define the operation. In this pattern, we can write generic code that defines a concept in its most abstract terms, allowing for later definitions of data and methods to interface with that code without change.
A major example of completely generic code are built-in container data structures...