diff options
author | Joel Galenson <jgalenson@google.com> | 2020-10-23 08:03:13 -0700 |
---|---|---|
committer | Joel Galenson <jgalenson@google.com> | 2020-10-23 08:03:13 -0700 |
commit | 4bf0c30e286d482eb711dc677be906adcba4650b (patch) | |
tree | de038d1f2268222ebb5925c40db9bda0e2d8e565 /src/sys/windows/io_status_block.rs | |
parent | 33e7b955494b6d15ed72863ad35c620e904302ed (diff) | |
download | mio-4bf0c30e286d482eb711dc677be906adcba4650b.tar.gz |
Import mio-0.7.3
Test: None
Change-Id: I7df903972aaf06adb1ecb20a63793fcf128edb8f
Diffstat (limited to 'src/sys/windows/io_status_block.rs')
-rw-r--r-- | src/sys/windows/io_status_block.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/sys/windows/io_status_block.rs b/src/sys/windows/io_status_block.rs new file mode 100644 index 0000000..db6729c --- /dev/null +++ b/src/sys/windows/io_status_block.rs @@ -0,0 +1,39 @@ +use ntapi::ntioapi::IO_STATUS_BLOCK; +use std::fmt; +use std::ops::{Deref, DerefMut}; + +pub struct IoStatusBlock(IO_STATUS_BLOCK); + +cfg_net! { + 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() + } +} |