|
|
@ -169,16 +169,16 @@ Here is a table of important variances which the rest of this section will be de
|
|
|
|
to trying to explain:
|
|
|
|
to trying to explain:
|
|
|
|
|
|
|
|
|
|
|
|
| | | 'a | T | U |
|
|
|
|
| | | 'a | T | U |
|
|
|
|
|---|---------------|:---------:|:-----------------:|:---------:|
|
|
|
|
|---|-----------------|:---------:|:-----------------:|:---------:|
|
|
|
|
| * | &'a T | covariant | covariant | |
|
|
|
|
| * | `&'a T ` | covariant | covariant | |
|
|
|
|
| * | &'a mut T | covariant | invariant | |
|
|
|
|
| * | `&'a mut T` | covariant | invariant | |
|
|
|
|
| * | Box<T> | | covariant | |
|
|
|
|
| * | `Box<T>` | | covariant | |
|
|
|
|
| | Vec<T> | | covariant | |
|
|
|
|
| | `Vec<T>` | | covariant | |
|
|
|
|
| * | UnsafeCell<T> | | invariant | |
|
|
|
|
| * | `UnsafeCell<T>` | | invariant | |
|
|
|
|
| | Cell<T> | | invariant | |
|
|
|
|
| | `Cell<T>` | | invariant | |
|
|
|
|
| * | fn(T) -> U | | **contra**variant | covariant |
|
|
|
|
| * | `fn(T) -> U` | | **contra**variant | covariant |
|
|
|
|
| | *const T | | covariant | |
|
|
|
|
| | `*const T` | | covariant | |
|
|
|
|
| | *mut T | | invariant | |
|
|
|
|
| | `*mut T` | | invariant | |
|
|
|
|
|
|
|
|
|
|
|
|
The types with \*'s are the ones we will be focusing on, as they are in
|
|
|
|
The types with \*'s are the ones we will be focusing on, as they are in
|
|
|
|
some sense "fundamental". All the others can be understood by analogy to the others:
|
|
|
|
some sense "fundamental". All the others can be understood by analogy to the others:
|
|
|
|