The solution is to cast the boxed concrete types to the boxed trait object: let mut xs: Vec<_> = Vec::new(); xs.push(Box::new(Type1) as Box<dyn Trait> ...
確定! 回上一頁