use std::ops::{Deref, DerefMut}; /// An unsafe wrapper to allow sending across threads /// /// USE WISELY, IT CAN CAUSE UB OTHERWISE pub struct Sendable(T); unsafe impl Send for Sendable {} unsafe impl Sync for Sendable {} impl Sendable { /// `T` must be Send+Sync safe pub unsafe fn new(t: T) -> Self { Sendable(t) } } impl Deref for Sendable { type Target = T; fn deref(&self) -> &Self::Target { &self.0 } } impl DerefMut for Sendable { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } #[macro_export] macro_rules! debug { ($($tt:tt)*) => { if cfg!(debug_assertions) { ::log::debug!($($tt)*); } }; }