trait Run {
    fn run(&self);
}

fn static_call<T:Run>(t:&T){
    t.run();    // 泛型调用
}

fn dynamic_call(r: &Run) {
    r.run();  // trait 对象调用
}

results matching ""

    No results matching ""