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:
125
125
126
126
いくつか重要な変性があります。
127
127
128
+ <!--
128
129
* `&'a T` is variant over `'a` and `T` (as is `*const T` by metaphor)
129
130
* `&'a mut T` is variant over `'a` but invariant over `T`
130
131
* `Fn(T) -> U` is invariant over `T`, but variant over `U`
131
132
* `Box`, `Vec`, and all other collections are variant over the types of
132
133
their contents
133
134
* `UnsafeCell<T>`, `Cell<T>`, `RefCell<T>`, `Mutex<T>` and all other
134
135
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 ` も同じということがわかるでしょう)
135
144
136
145
To understand why these variances are correct and desirable, we will consider
137
146
several examples.
You can’t perform that action at this time.
0 commit comments