#![allow(unused)]fnmain() {
structS; // Concrete type `S`// 具象型`S`structGenericVal<T>(T); // Generic type `GenericVal`// ジェネリック型`GenericVal`// impl of GenericVal where we explicitly specify type parameters:// 型パラメータを指定したうえで、GenericValにメソッドを実装impl GenericVal<f32> {} // Specify `f32`// `f32`の場合のメソッドimpl GenericVal<S> {} // Specify `S` as defined above// 上で定義した`S`への実装// `<T>` Must precede the type to remain generic// ジェネリック型のまま扱うには`<T>`が先に来る必要がある。impl<T> GenericVal<T> {}
}