Skip to content

Commit 14587f8

Browse files
committed
native: Switch field privacy as necessary
1 parent 5f33588 commit 14587f8

File tree

11 files changed

+39
-37
lines changed

11 files changed

+39
-37
lines changed

src/libnative/io/file_unix.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct Inner {
3030
}
3131

3232
pub struct FileDesc {
33-
priv inner: UnsafeArc<Inner>
33+
inner: UnsafeArc<Inner>
3434
}
3535

3636
impl FileDesc {
@@ -216,8 +216,8 @@ impl Drop for Inner {
216216
}
217217

218218
pub struct CFile {
219-
priv file: *libc::FILE,
220-
priv fd: FileDesc,
219+
file: *libc::FILE,
220+
fd: FileDesc,
221221
}
222222

223223
impl CFile {

src/libnative/io/file_win32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct Inner {
3434
}
3535

3636
pub struct FileDesc {
37-
priv inner: UnsafeArc<Inner>
37+
inner: UnsafeArc<Inner>
3838
}
3939

4040
impl FileDesc {

src/libnative/io/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
215215
/// Implementation of rt::rtio's IoFactory trait to generate handles to the
216216
/// native I/O functionality.
217217
pub struct IoFactory {
218-
priv cannot_construct_outside_of_this_module: ()
218+
cannot_construct_outside_of_this_module: ()
219219
}
220220

221221
impl IoFactory {

src/libnative/io/net.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub fn init() {
237237
////////////////////////////////////////////////////////////////////////////////
238238

239239
pub struct TcpStream {
240-
priv inner: UnsafeArc<Inner>,
240+
inner: UnsafeArc<Inner>,
241241
}
242242

243243
struct Inner {
@@ -373,7 +373,7 @@ impl Drop for Inner {
373373
////////////////////////////////////////////////////////////////////////////////
374374

375375
pub struct TcpListener {
376-
priv inner: UnsafeArc<Inner>,
376+
inner: UnsafeArc<Inner>,
377377
}
378378

379379
impl TcpListener {
@@ -430,7 +430,7 @@ impl rtio::RtioSocket for TcpListener {
430430
}
431431

432432
pub struct TcpAcceptor {
433-
priv listener: TcpListener,
433+
listener: TcpListener,
434434
}
435435

436436
impl TcpAcceptor {
@@ -474,7 +474,7 @@ impl rtio::RtioTcpAcceptor for TcpAcceptor {
474474
////////////////////////////////////////////////////////////////////////////////
475475

476476
pub struct UdpSocket {
477-
priv inner: UnsafeArc<Inner>,
477+
inner: UnsafeArc<Inner>,
478478
}
479479

480480
impl UdpSocket {

src/libnative/io/pipe_unix.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn bind(addr: &CString, ty: libc::c_int) -> IoResult<Inner> {
106106
////////////////////////////////////////////////////////////////////////////////
107107

108108
pub struct UnixStream {
109-
priv inner: UnsafeArc<Inner>,
109+
inner: UnsafeArc<Inner>,
110110
}
111111

112112
impl UnixStream {
@@ -160,7 +160,7 @@ impl rtio::RtioPipe for UnixStream {
160160
////////////////////////////////////////////////////////////////////////////////
161161

162162
pub struct UnixDatagram {
163-
priv inner: UnsafeArc<Inner>,
163+
inner: UnsafeArc<Inner>,
164164
}
165165

166166
impl UnixDatagram {
@@ -231,7 +231,7 @@ impl UnixDatagram {
231231
////////////////////////////////////////////////////////////////////////////////
232232

233233
pub struct UnixListener {
234-
priv inner: Inner,
234+
inner: Inner,
235235
}
236236

237237
impl UnixListener {
@@ -256,7 +256,7 @@ impl rtio::RtioUnixListener for UnixListener {
256256
}
257257

258258
pub struct UnixAcceptor {
259-
priv listener: UnixListener,
259+
listener: UnixListener,
260260
}
261261

262262
impl UnixAcceptor {

src/libnative/io/pipe_win32.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ unsafe fn pipe(name: *u16, init: bool) -> libc::HANDLE {
154154
////////////////////////////////////////////////////////////////////////////////
155155

156156
pub struct UnixStream {
157-
priv inner: UnsafeArc<Inner>,
158-
priv write: Option<Event>,
159-
priv read: Option<Event>,
157+
inner: UnsafeArc<Inner>,
158+
write: Option<Event>,
159+
read: Option<Event>,
160160
}
161161

162162
impl UnixStream {
@@ -349,8 +349,8 @@ impl rtio::RtioPipe for UnixStream {
349349
////////////////////////////////////////////////////////////////////////////////
350350

351351
pub struct UnixListener {
352-
priv handle: libc::HANDLE,
353-
priv name: CString,
352+
handle: libc::HANDLE,
353+
name: CString,
354354
}
355355

356356
impl UnixListener {
@@ -389,8 +389,8 @@ impl rtio::RtioUnixListener for UnixListener {
389389
}
390390

391391
pub struct UnixAcceptor {
392-
priv listener: UnixListener,
393-
priv event: Event,
392+
listener: UnixListener,
393+
event: Event,
394394
}
395395

396396
impl UnixAcceptor {

src/libnative/io/process.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ use super::file;
3131
*/
3232
pub struct Process {
3333
/// The unique id of the process (this should never be negative).
34-
priv pid: pid_t,
34+
pid: pid_t,
3535

3636
/// A handle to the process - on unix this will always be NULL, but on
3737
/// windows it will be a HANDLE to the process, which will prevent the
3838
/// pid being re-used until the handle is closed.
39-
priv handle: *(),
39+
handle: *(),
4040

4141
/// None until finish() is called.
42-
priv exit_code: Option<p::ProcessExit>,
42+
exit_code: Option<p::ProcessExit>,
4343
}
4444

4545
impl Process {

src/libnative/io/timer_other.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ use io::IoResult;
5959
use io::timer_helper;
6060

6161
pub struct Timer {
62-
priv id: uint,
63-
priv inner: Option<~Inner>,
62+
id: uint,
63+
inner: Option<~Inner>,
6464
}
6565

6666
struct Inner {

src/libnative/io/timer_timerfd.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ use io::IoResult;
4040
use io::timer_helper;
4141

4242
pub struct Timer {
43-
priv fd: FileDesc,
44-
priv on_worker: bool,
43+
fd: FileDesc,
44+
on_worker: bool,
4545
}
4646

4747
#[allow(visible_private_types)]
@@ -285,24 +285,24 @@ mod imp {
285285
#[cfg(target_arch = "x86_64")]
286286
#[packed]
287287
pub struct epoll_event {
288-
events: u32,
289-
data: i64,
288+
pub events: u32,
289+
pub data: i64,
290290
}
291291

292292
#[cfg(not(target_arch = "x86_64"))]
293293
pub struct epoll_event {
294-
events: u32,
295-
data: i64,
294+
pub events: u32,
295+
pub data: i64,
296296
}
297297

298298
pub struct timespec {
299-
tv_sec: libc::time_t,
300-
tv_nsec: libc::c_long,
299+
pub tv_sec: libc::time_t,
300+
pub tv_nsec: libc::c_long,
301301
}
302302

303303
pub struct itimerspec {
304-
it_interval: timespec,
305-
it_value: timespec,
304+
pub it_interval: timespec,
305+
pub it_value: timespec,
306306
}
307307

308308
extern {

src/libnative/io/timer_win32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ use io::timer_helper;
2929
use io::IoResult;
3030

3131
pub struct Timer {
32-
priv obj: libc::HANDLE,
33-
priv on_worker: bool,
32+
obj: libc::HANDLE,
33+
on_worker: bool,
3434
}
3535

3636
pub enum Req {

src/libnative/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
#![deny(unused_result, unused_must_use)]
5252
#![allow(non_camel_case_types)]
5353

54+
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
55+
5456
// NB this crate explicitly does *not* allow glob imports, please seriously
5557
// consider whether they're needed before adding that feature here (the
5658
// answer is that you don't need them)

0 commit comments

Comments
 (0)