PhantomPinned

Definition

pub struct PhantomPinned;

impl !Unpin for PhantomPinned {}

Usage

pub struct DynamicBuffer {
    data: Vec<u8>,
    cursor: std::ptr::NonNull<u8>,
    _pin: std::marker::PhantomPinned,
}
This slide should take about 5 minutes.

PhantomPinned is a marker type.

If a type contains a PhantomPinned, it will not implement Unpin by default.

This has the effect of enforcing pinning when DynamicBuffer is wrapped by Pin.