Trait objects are another mechanism Rust has for storing a data value that might be one of several possible types into a single variable, but before we can talk about trait objects, we need to talk about traits.
Traits and trait objects
Traits
A trait is a name and formal definition for a specific bit of functionality that a data type may provide. Previously, we've talked about how data types might have the Copy trait, and how, when they do, the compiler copies them instead of moving them. That is the general idea: when a trait is implemented for a data type, that data type gains the ability to interact with the rest of the program in some specific way.
Some of the built-in traits, such as Copy, actually affect how the...