mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
Remove NonZeroDWORD
This commit is contained in:
parent
8b72d7a9d7
commit
1d1cae1ba5
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
use crate::ffi::CStr;
|
use crate::ffi::CStr;
|
||||||
use crate::mem;
|
use crate::mem;
|
||||||
use crate::num::NonZero;
|
|
||||||
pub use crate::os::raw::c_int;
|
pub use crate::os::raw::c_int;
|
||||||
use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void};
|
use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void};
|
||||||
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
|
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
|
||||||
@ -19,7 +18,6 @@ mod windows_sys;
|
|||||||
pub use windows_sys::*;
|
pub use windows_sys::*;
|
||||||
|
|
||||||
pub type DWORD = c_ulong;
|
pub type DWORD = c_ulong;
|
||||||
pub type NonZeroDWORD = NonZero<c_ulong>;
|
|
||||||
pub type LARGE_INTEGER = c_longlong;
|
pub type LARGE_INTEGER = c_longlong;
|
||||||
#[cfg_attr(target_vendor = "uwp", allow(unused))]
|
#[cfg_attr(target_vendor = "uwp", allow(unused))]
|
||||||
pub type LONG = c_long;
|
pub type LONG = c_long;
|
||||||
|
@ -19,7 +19,7 @@ use crate::path::{Path, PathBuf};
|
|||||||
use crate::ptr;
|
use crate::ptr;
|
||||||
use crate::sync::Mutex;
|
use crate::sync::Mutex;
|
||||||
use crate::sys::args::{self, Arg};
|
use crate::sys::args::{self, Arg};
|
||||||
use crate::sys::c::{self, NonZeroDWORD, EXIT_FAILURE, EXIT_SUCCESS};
|
use crate::sys::c::{self, EXIT_FAILURE, EXIT_SUCCESS};
|
||||||
use crate::sys::cvt;
|
use crate::sys::cvt;
|
||||||
use crate::sys::fs::{File, OpenOptions};
|
use crate::sys::fs::{File, OpenOptions};
|
||||||
use crate::sys::handle::Handle;
|
use crate::sys::handle::Handle;
|
||||||
@ -717,7 +717,7 @@ pub struct ExitStatus(c::DWORD);
|
|||||||
|
|
||||||
impl ExitStatus {
|
impl ExitStatus {
|
||||||
pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
|
pub fn exit_ok(&self) -> Result<(), ExitStatusError> {
|
||||||
match NonZeroDWORD::try_from(self.0) {
|
match NonZero::<u32>::try_from(self.0) {
|
||||||
/* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)),
|
/* was nonzero */ Ok(failure) => Err(ExitStatusError(failure)),
|
||||||
/* was zero, couldn't convert */ Err(_) => Ok(()),
|
/* was zero, couldn't convert */ Err(_) => Ok(()),
|
||||||
}
|
}
|
||||||
@ -750,7 +750,7 @@ impl fmt::Display for ExitStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
|
||||||
pub struct ExitStatusError(c::NonZeroDWORD);
|
pub struct ExitStatusError(NonZero<u32>);
|
||||||
|
|
||||||
impl Into<ExitStatus> for ExitStatusError {
|
impl Into<ExitStatus> for ExitStatusError {
|
||||||
fn into(self) -> ExitStatus {
|
fn into(self) -> ExitStatus {
|
||||||
|
Loading…
Reference in New Issue
Block a user