update zh/traits.md

This commit is contained in:
sunface
2022-03-08 16:43:22 +08:00
parent c9ce0d80d0
commit 2a121b7202
2 changed files with 27 additions and 26 deletions

View File

@ -341,12 +341,14 @@ fn main() {
}
// implement `fn sum` with trait bound in two ways
fn sum<T: std::ops::Add<Output = T>>(x: T, y: T) -> T {
fn sum<T>(x: T, y: T) -> T {
x + y
}
```
8. 🌟🌟
```rust,editable
// FIX the errors
struct Pair<T> {
x: T,
y: T,