trait object
trait T {}
struct S(Vec<T>)- trait objectにするために
dynを付ける
struct S(Vec<dyn T>)
the trait `Sized` is not implemented for `(dyn T + 'static)`
- 構造体はコンパイル時にサイズが決まらないといけないが, triat objectは不定
- -> Boxでポインタにする
- 動的ディスパッチ という
struct S(Vec<dyn T>)
- 静的ディスパッチ
f(impl T)