Merge pull request #48 from YangFong/doc-ch10-02

doc: Optimize the description at ch10-02
This commit is contained in:
Aaran Xu 2022-01-14 23:30:18 +08:00 committed by GitHub
commit 97d548340b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
*trait* 告诉 Rust 编译器某个特定类型拥有可能与其他类型共享的功能。可以通过 trait 以一种抽象的方式定义共享的行为。可以使用 *trait bounds* 指定泛型是任何拥有特定行为的类型。
> 注意:*trait* 类似于其他语言中常被称为 **接口***interfaces*)的功能,虽然有一些不同。
> 注意:*trait* 类似于其他语言中常被称为 **接口***interfaces*)的功能,虽然有一些不同。
### 定义 trait
@ -166,7 +166,7 @@ println!("1 new tweet: {}", tweet.summarize());
这会打印出 `1 new tweet: (Read more from @horse_ebooks...)`
注意无法从相同方法的重载实现中调用默认方法。
注意无法从相同方法的重载实现中调用默认方法。
### trait 作为参数