1 #[derive(Clone, Copy)] 2 pub struct UnsafeSendSync<T>(T); 3 4 impl<T> UnsafeSendSync<T> { 5 /// Create a new `UnsafeSendSync` wrapper around the given value. 6 /// 7 /// The result is a type that is `Send` and `Sync` regardless of whether `T: 8 /// Send + Sync`, so this constructor is unsafe. new(val: T) -> Self9 pub unsafe fn new(val: T) -> Self { 10 UnsafeSendSync(val) 11 } 12 get(&self) -> &T13 pub fn get(&self) -> &T { 14 &self.0 15 } 16 } 17 18 unsafe impl<T> Send for UnsafeSendSync<T> {} 19 unsafe impl<T> Sync for UnsafeSendSync<T> {} 20