Merge pull request #1489 from gtofish/patch-2

Update advance-trait.md
main
Sunface 1 month ago committed by GitHub
commit 8c94bc61ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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;
}
## 默认泛型类型参数

Loading…
Cancel
Save