Skip to content

Commit 08a4519

Browse files
committed
Refactor fixed-width integer types into its own module
1 parent b6ab2f0 commit 08a4519

File tree

10 files changed

+36
-71
lines changed

10 files changed

+36
-71
lines changed

src/cloudabi/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
pub type int8_t = i8;
2-
pub type int16_t = i16;
3-
pub type int32_t = i32;
4-
pub type int64_t = i64;
5-
pub type uint8_t = u8;
6-
pub type uint16_t = u16;
7-
pub type uint32_t = u32;
8-
pub type uint64_t = u64;
9-
101
pub type c_schar = i8;
112
pub type c_uchar = u8;
123
pub type c_short = i16;

src/fixed_width_ints.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! This module contains type aliases for C's fixed-width integer types .
2+
//!
3+
//! These aliases are deprecated: use the Rust types instead.
4+
5+
pub type int8_t = i8;
6+
pub type int16_t = i16;
7+
pub type int32_t = i32;
8+
pub type int64_t = i64;
9+
pub type uint8_t = u8;
10+
pub type uint16_t = u16;
11+
pub type uint32_t = u32;
12+
pub type uint64_t = u64;

src/fuchsia/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
66
// PUB_TYPE
77

8-
pub type int8_t = i8;
9-
pub type int16_t = i16;
10-
pub type int32_t = i32;
11-
pub type int64_t = i64;
12-
pub type uint8_t = u8;
13-
pub type uint16_t = u16;
14-
pub type uint32_t = u32;
15-
pub type uint64_t = u64;
16-
178
pub type c_schar = i8;
189
pub type c_uchar = u8;
1910
pub type c_short = i16;

src/hermit/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
// Ported by Colin Fink <[email protected]>
1414
// and Stefan Lankes <[email protected]>
1515

16-
pub type int8_t = i8;
17-
pub type int16_t = i16;
18-
pub type int32_t = i32;
19-
pub type int64_t = i64;
20-
pub type uint8_t = u8;
21-
pub type uint16_t = u16;
22-
pub type uint32_t = u32;
23-
pub type uint64_t = u64;
24-
2516
pub type c_schar = i8;
2617
pub type c_uchar = u8;
2718
pub type c_short = i16;

src/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,27 +90,51 @@ cfg_if! {
9090

9191
cfg_if! {
9292
if #[cfg(windows)] {
93+
mod fixed_width_ints;
94+
pub use fixed_width_ints::*;
95+
9396
mod windows;
9497
pub use windows::*;
9598
} else if #[cfg(target_os = "cloudabi")] {
99+
mod fixed_width_ints;
100+
pub use fixed_width_ints::*;
101+
96102
mod cloudabi;
97103
pub use cloudabi::*;
98104
} else if #[cfg(target_os = "fuchsia")] {
105+
mod fixed_width_ints;
106+
pub use fixed_width_ints::*;
107+
99108
mod fuchsia;
100109
pub use fuchsia::*;
101110
} else if #[cfg(target_os = "switch")] {
111+
mod fixed_width_ints;
112+
pub use fixed_width_ints::*;
113+
102114
mod switch;
103115
pub use switch::*;
104116
} else if #[cfg(unix)] {
117+
mod fixed_width_ints;
118+
pub use fixed_width_ints::*;
119+
105120
mod unix;
106121
pub use unix::*;
107122
} else if #[cfg(target_os = "hermit")] {
123+
mod fixed_width_ints;
124+
pub use fixed_width_ints::*;
125+
108126
mod hermit;
109127
pub use hermit::*;
110128
} else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] {
129+
mod fixed_width_ints;
130+
pub use fixed_width_ints::*;
131+
111132
mod sgx;
112133
pub use sgx::*;
113134
} else if #[cfg(any(target_env = "wasi", target_os = "wasi"))] {
135+
mod fixed_width_ints;
136+
pub use fixed_width_ints::*;
137+
114138
mod wasi;
115139
pub use wasi::*;
116140
} else {

src/sgx.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
//! SGX C types definition
22
3-
pub type int8_t = i8;
4-
pub type int16_t = i16;
5-
pub type int32_t = i32;
6-
pub type int64_t = i64;
7-
pub type uint8_t = u8;
8-
pub type uint16_t = u16;
9-
pub type uint32_t = u32;
10-
pub type uint64_t = u64;
11-
123
pub type c_schar = i8;
134
pub type c_uchar = u8;
145
pub type c_short = i16;

src/switch.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
//! Switch C type definitions
22
3-
pub type int8_t = i8;
4-
pub type int16_t = i16;
5-
pub type int32_t = i32;
6-
pub type int64_t = i64;
7-
pub type uint8_t = u8;
8-
pub type uint16_t = u16;
9-
pub type uint32_t = u32;
10-
pub type uint64_t = u64;
11-
123
pub type c_schar = i8;
134
pub type c_uchar = u8;
145
pub type c_short = i16;

src/unix/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
//! More functions and definitions can be found in the more specific modules
44
//! according to the platform in question.
55
6-
pub type int8_t = i8;
7-
pub type int16_t = i16;
8-
pub type int32_t = i32;
9-
pub type int64_t = i64;
10-
pub type uint8_t = u8;
11-
pub type uint16_t = u16;
12-
pub type uint32_t = u32;
13-
pub type uint64_t = u64;
14-
156
pub type c_schar = i8;
167
pub type c_uchar = u8;
178
pub type c_short = i16;

src/wasi.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ pub type intptr_t = isize;
1919
pub type uintptr_t = usize;
2020
pub type off_t = i64;
2121
pub type pid_t = i32;
22-
pub type int8_t = i8;
23-
pub type uint8_t = u8;
24-
pub type int16_t = i16;
25-
pub type uint16_t = u16;
26-
pub type int32_t = i32;
27-
pub type uint32_t = u32;
28-
pub type int64_t = i64;
29-
pub type uint64_t = u64;
3022
pub type clock_t = c_longlong;
3123
pub type time_t = c_longlong;
3224
pub type c_double = f64;

src/windows/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
//! Windows CRT definitions
22
3-
pub type int8_t = i8;
4-
pub type int16_t = i16;
5-
pub type int32_t = i32;
6-
pub type int64_t = i64;
7-
pub type uint8_t = u8;
8-
pub type uint16_t = u16;
9-
pub type uint32_t = u32;
10-
pub type uint64_t = u64;
11-
123
pub type c_schar = i8;
134
pub type c_uchar = u8;
145
pub type c_short = i16;

0 commit comments

Comments
 (0)