面试题答案
一键面试trait CollectionProcessor {
type Item;
fn process(&self) -> Vec<Self::Item>;
}
impl CollectionProcessor for Vec<i32> {
type Item = i32;
fn process(&self) -> Vec<Self::Item> {
self.iter().map(|&x| x * x).collect()
}
}