Rust Vector of Traits: cast each trait
问题 I have a problem casting a vector of traits into a vector of different traits. Using the approach of Type-casting arrays/vectors in Rust , I basically tried the following: trait ParentTrait {} trait ChildTrait: ParentTrait {} fn main() { let mut children: Vec<Box<ChildTrait>> = vec![]; let parents = children.iter().map(|&e| e as Box<ParentTrait>); } Now this does not compile, it results in error: the trait `core::kinds::Sized` is not implemented for the type `ChildTrait` [...] error: the