trait 是一个告诉Rust 编译器一个类型必须提供哪些功能语言特性。 ... use std::fmt::Debug; fn foo<T: Clone + Debug>(x: T) { x.clone(); println!("{:?}", x); }.
確定! 回上一頁