File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -125,13 +125,22 @@ Some important variances:
125125
126126いくつか重要な変性があります。
127127
128+ <!--
128129* `&'a T` is variant over `'a` and `T` (as is `*const T` by metaphor)
129130* `&'a mut T` is variant over `'a` but invariant over `T`
130131* `Fn(T) -> U` is invariant over `T`, but variant over `U`
131132* `Box`, `Vec`, and all other collections are variant over the types of
132133 their contents
133134* `UnsafeCell<T>`, `Cell<T>`, `RefCell<T>`, `Mutex<T>` and all other
134135 interior mutability types are invariant over T (as is `*mut T` by metaphor)
136+ -->
137+
138+ * ` &'a T ` は ` 'a ` と ` T ` において変性です( ` *const T ` も同じということがわかるでしょう)
139+ * ` &'a mut T ` は ` 'a ` において変性ですが、 ` T ` においては非変性です
140+ * ` Fn(T) -> U ` は ` T ` において非変性ですが、 ` U ` においては変性です
141+ * ` Box ` や ` Vec ` や他の全てのコレクションは、要素の型において変性です
142+ * ` UnsafeCell<T> ` 、` Cell<T> ` 、` RefCell<T> ` 、` Mutex<T> ` や他の内部可変性型は ` T ` において
143+ 非変性です( ` *mut T ` も同じということがわかるでしょう)
135144
136145To understand why these variances are correct and desirable, we will consider
137146several examples.
You can’t perform that action at this time.
0 commit comments