While I was reading The Rust Programming Language, I came across the statement (emphasis mine):
To determine how much space to allocate for a
Messagevalue, Rust goes through each of the variants to see which variant needs the most space. Rust sees thatMessage::Quitdoesn’t need any space,Message::Moveneeds enough space to store twoi32values, and so forth. Because only one variant will be used, the most space aMessagevalue will need is the space it would take to store the largest of its variants.
The Message enum is defined as:
enum Message {
Quit,
Move { x: i32, y: i32 },
Write(String),
ChangeColor(i32, i32, i32),
}
What does the bold statement mean in detail?