File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -28,4 +28,11 @@ The meaning of `impl Trait` is a bit different in the different positions.
28
28
without naming the type. This can be useful when you don't want to expose the concrete type in a
29
29
public API.
30
30
31
+ This example is great, because it uses ` impl Display ` twice. It helps to explain that
32
+ nothing here enforces that it is _ the same_ ` impl Display ` type. If we used a single
33
+ ` T: Display ` , it would enforce the constraint that input ` T ` and return ` T ` type are the same type.
34
+ It would not work for this particular function, as the type we expect as input is likely not
35
+ what ` format! ` returns. If we wanted to do the same via ` : Display ` syntax, we'd need two
36
+ independent generic parameters.
37
+
31
38
</details >
You can’t perform that action at this time.
0 commit comments