We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05cc2ff commit b75e713Copy full SHA for b75e713
src/generics/methods.md
@@ -19,3 +19,13 @@ fn main() {
19
println!("p.x = {}", p.x());
20
}
21
```
22
+
23
+<details>
24
25
+* *Q:* Why `T` is specified twice in `impl<T> Point<T> {}`? Isn't that redundant?
26
+ * This is because it is a generic implementation section for generic type. They are independently generic.
27
+ * It means these methods are defined for any `T`.
28
+ * It is possible to write `impl Point<u32> { .. }`.
29
+ * `Point` is still generic and you can use `Point<f64>`, but methods in this block will only be available for `Point<u32>`.
30
31
+</details>
0 commit comments