marker.rs 452 B

123456789101112
  1. use core::{cell::UnsafeCell, marker::PhantomData};
  2. /// A marker type that indicates that the type is not `Send`.
  3. pub struct NotSend(PhantomData<*const ()>);
  4. /// A marker type that indicates that the type is not `Sync`.
  5. #[allow(dead_code)]
  6. pub struct NotSync(PhantomData<UnsafeCell<()>>);
  7. // SAFETY: This is a marker type that indicates that the type is not `Send`.
  8. // So no restrictions on `Sync` are needed.
  9. unsafe impl Sync for NotSend {}