I am brainstoming about what I can do with a
Unpin + Copy but not a
!Unpin + Copy.
So let me define
struct PinnedI32(i32, PhantomPinned);
This is just a newtype of
i32. Now we can do
let mut pv = Box::pin(2);
let p = pv.as_mut().get_mut();
let mut pv = Box::pin(PinnedI32(2));
//illigal beacause `PinnedI32` is not `Unpin`
//let p = pv.as_mut().get_mut();
//*p = 3;
So they do have difference. By change the data from a normal
Unpin + Copy type to
!Unpin + Copy, the data was effectively freezed after a
Pin pointer being created: now you need unsafe code to mutate the value.
Therefore the conclusion is that
!Unpin + Copy means the pinned value is garanteed immutable until
Droped by the container?