aboutsummaryrefslogtreecommitdiff
path: root/src/sys/windows/io_status_block.rs
blob: 3e603349617c524241d30aa373566d1fb2fe153c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::fmt;
use std::ops::{Deref, DerefMut};

use ntapi::ntioapi::IO_STATUS_BLOCK;

pub struct IoStatusBlock(IO_STATUS_BLOCK);

cfg_io_source! {
    use ntapi::ntioapi::IO_STATUS_BLOCK_u;

    impl IoStatusBlock {
        pub fn zeroed() -> Self {
            Self(IO_STATUS_BLOCK {
                u: IO_STATUS_BLOCK_u { Status: 0 },
                Information: 0,
            })
        }
    }
}

unsafe impl Send for IoStatusBlock {}

impl Deref for IoStatusBlock {
    type Target = IO_STATUS_BLOCK;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl DerefMut for IoStatusBlock {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}

impl fmt::Debug for IoStatusBlock {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.debug_struct("IoStatusBlock").finish()
    }
}