File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -101,15 +101,23 @@ subtyping of its outputs. There are two kinds of variance in Rust:
101101-->
102102
103103* もし ` T ` が ` U ` の派生型である時、 ` F<T> ` が ` F<U> ` の派生型であるならば、 ` F ` は
104- * 変性* です。(派生型の「パススルー」)
104+ ` T ` において * 変性* です。(派生型の「パススルー」)
105105* それ以外の場合、 ` T ` は* 非変性* です。(いかなる派生型の関係も継承されません)
106106
107+ <!--
107108(For those of you who are familiar with variance from other languages, what we
108109refer to as "just" variance is in fact *covariance*. Rust has *contravariance*
109110for functions. The future of contravariance is uncertain and it may be
110111scrapped. For now, `fn(T)` is contravariant in `T`, which is used in matching
111112methods in trait implementations to the trait definition. Traits don't have
112113inferred variance, so `Fn(T)` is invariant in `T`).
114+ -->
115+
116+ (他の言語で変性に慣れている方にとって、「単に」変性と言及しているものは実は* 共変性* です。
117+ Rust では関数に* 反変性* が存在します。将来的に反変性がどうなるかは未定で、
118+ 反変性が廃止されるかもしれません。今の所、 ` fn(T) ` は ` T ` の反変性で、これは
119+ トレイトの定義に対してトレイトの実装内のメソッドをマッチさせるのに使われます。
120+ トレイトは推論された変性を持たないため、 ` fn(T) ` は ` T ` において変性ではありません。)
113121
114122Some important variances:
115123
You can’t perform that action at this time.
0 commit comments