1 use crate::sys::windows::Event; 2 3 use std::cell::UnsafeCell; 4 use std::fmt; 5 6 #[cfg(feature = "os-ext")] 7 use winapi::um::minwinbase::OVERLAPPED; 8 use winapi::um::minwinbase::OVERLAPPED_ENTRY; 9 10 #[repr(C)] 11 pub(crate) struct Overlapped { 12 inner: UnsafeCell<miow::Overlapped>, 13 pub(crate) callback: fn(&OVERLAPPED_ENTRY, Option<&mut Vec<Event>>), 14 } 15 16 #[cfg(feature = "os-ext")] 17 impl Overlapped { new(cb: fn(&OVERLAPPED_ENTRY, Option<&mut Vec<Event>>)) -> Overlapped18 pub(crate) fn new(cb: fn(&OVERLAPPED_ENTRY, Option<&mut Vec<Event>>)) -> Overlapped { 19 Overlapped { 20 inner: UnsafeCell::new(miow::Overlapped::zero()), 21 callback: cb, 22 } 23 } 24 as_ptr(&self) -> *const OVERLAPPED25 pub(crate) fn as_ptr(&self) -> *const OVERLAPPED { 26 unsafe { (*self.inner.get()).raw() } 27 } 28 } 29 30 impl fmt::Debug for Overlapped { fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result31 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 32 f.debug_struct("Overlapped").finish() 33 } 34 } 35 36 unsafe impl Send for Overlapped {} 37 unsafe impl Sync for Overlapped {} 38