Uses of Box:

  1. For recursive types: Since their size cannot be known at compile time, rust uses a Box which is a pointer on the stack to contents on the heap.
enum List {
  Cons(i16, Box<List>),
  Nil,
}
  1. Data larger than the stack (staci is typically up to ~8MB).

  2. Trait objects