mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-23 18:18:13 +08:00
Merge branch 'main' of https://github.com/KaiserY/trpl-zh-cn
This commit is contained in:
commit
cc6e5e7904
@ -189,7 +189,7 @@ fn some_function<T: Display + Clone, U: Clone + Debug>(t: &T, u: &U) -> i32 {
|
||||
{{#rustdoc_include ../listings/ch10-generic-types-traits-and-lifetimes/no-listing-06-impl-trait-returns-one-type/src/lib.rs:here}}
|
||||
```
|
||||
|
||||
这里尝试返回 `NewsArticle` 或 `SocialPost` 是不被允许的,原因在于编译器中 `impl Trait` 语法的实现限制。。第十八章的 [“顾及不同类型值的 trait 对象”][using-trait-objects-that-allow-for-values-of-different-types] 部分会介绍如何编写这样一个函数。
|
||||
这里尝试返回 `NewsArticle` 或 `SocialPost` 是不被允许的,原因在于编译器中 `impl Trait` 语法的实现限制。第十八章的 [“顾及不同类型值的 trait 对象”][using-trait-objects-that-allow-for-values-of-different-types] 部分会介绍如何编写这样一个函数。
|
||||
|
||||
### 使用 trait bound 有条件地实现方法
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user