Skip to content

Commit

Permalink
phantom-data: Add Send and Sync columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Enselic committed May 30, 2023
1 parent 927dfbd commit bda5c0c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/phantom-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ standard library made a utility for itself called `Unique<T>` which:

Here’s a table of all the wonderful ways `PhantomData` could be used:

| Phantom type | `'a` | `T` |
|-----------------------------|-----------|---------------------------|
| `PhantomData<T>` | - | covariant (with drop check) |
| `PhantomData<&'a T>` | covariant | covariant |
| `PhantomData<&'a mut T>` | covariant | invariant |
| `PhantomData<*const T>` | - | covariant |
| `PhantomData<*mut T>` | - | invariant |
| `PhantomData<fn(T)>` | - | contravariant |
| `PhantomData<fn() -> T>` | - | covariant |
| `PhantomData<fn(T) -> T>` | - | invariant |
| `PhantomData<Cell<&'a ()>>` | invariant | - |
| Phantom type | `'a` | `T` | `Send` | `Sync` |
|-----------------------------|-----------|-----------------------------|-----------|-----------|
| `PhantomData<T>` | - | covariant (with drop check) | `T: Send` | `T: Sync` |
| `PhantomData<&'a T>` | covariant | covariant | `T: Send` | `T: Sync` |
| `PhantomData<&'a mut T>` | covariant | invariant | `T: Send` | `T: Sync` |
| `PhantomData<*const T>` | - | covariant | - | - |
| `PhantomData<*mut T>` | - | invariant | - | - |
| `PhantomData<fn(T)>` | - | contravariant | `Send` | `Sync` |
| `PhantomData<fn() -> T>` | - | covariant | `Send` | `Sync` |
| `PhantomData<fn(T) -> T>` | - | invariant | `Send` | `Sync` |
| `PhantomData<Cell<&'a ()>>` | invariant | - | `Send` | - |

0 comments on commit bda5c0c

Please sign in to comment.