Debian Codegraph @

third_party/rust/mio/src/sys/windows/io_status_block.rs

raw
1 use std::fmt;
2 use std::ops::{Deref, DerefMut};
3
4 use windows_sys::Win32::System::IO::IO_STATUS_BLOCK;
5
6 pub struct IoStatusBlock(IO_STATUS_BLOCK);
7
8 cfg_io_source! {
9 use windows_sys::Win32::System::IO::IO_STATUS_BLOCK_0;
10
11 impl IoStatusBlock {
12 pub fn zeroed() -> Self {
13 Self(IO_STATUS_BLOCK {
14 Anonymous: IO_STATUS_BLOCK_0 { Status: 0 },
15 Information: 0,
16 })
17 }
18 }
19 }
20
21 unsafe impl Send for IoStatusBlock {}
22
23 impl Deref for IoStatusBlock {
24 type Target = IO_STATUS_BLOCK;
25 fn deref(&self) -> &Self::Target {
26 &self.0
27 }
28 }
29
30 impl DerefMut for IoStatusBlock {
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34 }
35
36 impl fmt::Debug for IoStatusBlock {
37 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38 f.debug_struct("IoStatusBlock").finish()
39 }
40 }