Skip to content

Commit

Permalink
Merge pull request sunface#1489 from gtofish/patch-2
Browse files Browse the repository at this point in the history
Update advance-trait.md
  • Loading branch information
sunface authored Jan 9, 2025
2 parents bbb084e + a977fd7 commit 8c94bc6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/basic/trait/advance-trait.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ trait Container{

fn difference<C: Container>(container: &C) {}
```
关联类型还可以被其它特征进行约束,例如:
```rust
trait Container{
type ADisplay;
type B;
fn contains(&self, a: &Self::A, b: &Self::B) -> bool;
}

## 默认泛型类型参数

Expand Down

0 comments on commit 8c94bc6

Please sign in to comment.