和函数类似,impl
块要想实现泛型,也需要很仔细。
#![allow(unused)]
fn main() {
struct S;
struct GenericVal<T>(T,);
impl GenericVal<f32> {}
impl GenericVal<S> {}
impl <T> GenericVal<T> {}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
返回引用的函数, impl
, 和 struct