]> git.lizzy.rs Git - rust.git/commitdiff
rustuv: Switch field privacy as necessary
authorAlex Crichton <alex@alexcrichton.com>
Fri, 28 Mar 2014 17:27:14 +0000 (10:27 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Mon, 31 Mar 2014 22:47:36 +0000 (15:47 -0700)
src/librustuv/access.rs
src/librustuv/file.rs
src/librustuv/homing.rs
src/librustuv/lib.rs
src/librustuv/net.rs
src/librustuv/pipe.rs
src/librustuv/queue.rs
src/librustuv/rc.rs
src/librustuv/stream.rs
src/librustuv/uvio.rs
src/librustuv/uvll.rs

index 9d06593a6eafd323208074f770eef7eac55369f8..0d2550d4ebda22116853d949042eaa73e186b137 100644 (file)
 use homing::HomingMissile;
 
 pub struct Access {
-    priv inner: UnsafeArc<Inner>,
+    inner: UnsafeArc<Inner>,
 }
 
 pub struct Guard<'a> {
-    priv access: &'a mut Access,
-    priv missile: Option<HomingMissile>,
+    access: &'a mut Access,
+    missile: Option<HomingMissile>,
 }
 
 struct Inner {
index d5235a9fe56b3aed66fb4d993d2913b805197542..93cc1d8d54f141ce37ef5a2d55a9861994c54742 100644 (file)
 
 pub struct FsRequest {
     req: *uvll::uv_fs_t,
-    priv fired: bool,
+    fired: bool,
 }
 
 pub struct FileWatcher {
-    priv loop_: Loop,
-    priv fd: c_int,
-    priv close: rtio::CloseBehavior,
-    priv home: HomeHandle,
+    loop_: Loop,
+    fd: c_int,
+    close: rtio::CloseBehavior,
+    home: HomeHandle,
 }
 
 impl FsRequest {
index aa345ca32aa7e2424a4fdfcc79b0c1d7ebfe5112..89b68917c94838f35edd9dedc67136b9b8b1402e 100644 (file)
@@ -48,8 +48,8 @@
 /// Handles are clone-able in order to derive new handles from existing handles
 /// (very useful for when accepting a socket from a server).
 pub struct HomeHandle {
-    priv queue: Queue,
-    priv id: uint,
+    queue: Queue,
+    id: uint,
 }
 
 impl HomeHandle {
@@ -126,7 +126,7 @@ fn fire_homing_missile(&mut self) -> HomingMissile {
 /// task back to its appropriate home (if applicable). The field is used to
 /// assert that we are where we think we are.
 pub struct HomingMissile {
-    priv io_home: uint,
+    io_home: uint,
 }
 
 impl HomingMissile {
index 427dd87a0a189d60e5d7fff4675c98874cd328c5..01067cb699b82b1811d7cdabe86d88a9bc058c7a 100644 (file)
@@ -197,8 +197,8 @@ fn close(&mut self) {
 }
 
 pub struct ForbidSwitch {
-    priv msg: &'static str,
-    priv io: uint,
+    msg: &'static str,
+    io: uint,
 }
 
 impl ForbidSwitch {
@@ -261,8 +261,8 @@ fn wakeup(slot: &mut Option<BlockedTask>) {
 }
 
 pub struct Request {
-    handle: *uvll::uv_req_t,
-    priv defused: bool,
+    pub handle: *uvll::uv_req_t,
+    defused: bool,
 }
 
 impl Request {
@@ -313,7 +313,7 @@ fn drop(&mut self) {
 /// with dtors may not be destructured, but tuple structs can,
 /// but the results are not correct.
 pub struct Loop {
-    priv handle: *uvll::uv_loop_t
+    handle: *uvll::uv_loop_t
 }
 
 impl Loop {
index cfecdd929f38d25ccf6b3d84b2be25ad4de64c70..0514975cc7b277f7643be02f18bb01c72cdb01e2 100644 (file)
@@ -153,22 +153,22 @@ pub struct TcpWatcher {
     handle: *uvll::uv_tcp_t,
     stream: StreamWatcher,
     home: HomeHandle,
-    priv refcount: Refcount,
+    refcount: Refcount,
 
     // libuv can't support concurrent reads and concurrent writes of the same
     // stream object, so we use these access guards in order to arbitrate among
     // multiple concurrent reads and writes. Note that libuv *can* read and
     // write simultaneously, it just can't read and read simultaneously.
-    priv read_access: Access,
-    priv write_access: Access,
+    read_access: Access,
+    write_access: Access,
 }
 
 pub struct TcpListener {
     home: HomeHandle,
     handle: *uvll::uv_pipe_t,
-    priv closing_task: Option<BlockedTask>,
-    priv outgoing: Sender<Result<~rtio::RtioTcpStream:Send, IoError>>,
-    priv incoming: Receiver<Result<~rtio::RtioTcpStream:Send, IoError>>,
+    closing_task: Option<BlockedTask>,
+    outgoing: Sender<Result<~rtio::RtioTcpStream:Send, IoError>>,
+    incoming: Receiver<Result<~rtio::RtioTcpStream:Send, IoError>>,
 }
 
 pub struct TcpAcceptor {
@@ -476,9 +476,9 @@ pub struct UdpWatcher {
     home: HomeHandle,
 
     // See above for what these fields are
-    priv refcount: Refcount,
-    priv read_access: Access,
-    priv write_access: Access,
+    refcount: Refcount,
+    read_access: Access,
+    write_access: Access,
 }
 
 impl UdpWatcher {
index e1226f0b3a98c413d61a1a8647f88737e3b3191a..ea46c3a129678e80b527945eaf3bea40853eab20 100644 (file)
 pub struct PipeWatcher {
     stream: StreamWatcher,
     home: HomeHandle,
-    priv defused: bool,
-    priv refcount: Refcount,
+    defused: bool,
+    refcount: Refcount,
 
     // see comments in TcpWatcher for why these exist
-    priv write_access: Access,
-    priv read_access: Access,
+    write_access: Access,
+    read_access: Access,
 }
 
 pub struct PipeListener {
     home: HomeHandle,
     pipe: *uvll::uv_pipe_t,
-    priv outgoing: Sender<Result<~RtioPipe:Send, IoError>>,
-    priv incoming: Receiver<Result<~RtioPipe:Send, IoError>>,
+    outgoing: Sender<Result<~RtioPipe:Send, IoError>>,
+    incoming: Receiver<Result<~RtioPipe:Send, IoError>>,
 }
 
 pub struct PipeAcceptor {
index ad0de0b46c9cff02f165b07eb8ce9e44f5a5305e..f5643e80f4a08466bbc667e3a543405d14500e9e 100644 (file)
@@ -46,13 +46,13 @@ struct State {
 /// This structure is intended to be stored next to the event loop, and it is
 /// used to create new `Queue` structures.
 pub struct QueuePool {
-    priv queue: UnsafeArc<State>,
-    priv refcnt: uint,
+    queue: UnsafeArc<State>,
+    refcnt: uint,
 }
 
 /// This type is used to send messages back to the original event loop.
 pub struct Queue {
-    priv queue: UnsafeArc<State>,
+    queue: UnsafeArc<State>,
 }
 
 extern fn async_cb(handle: *uvll::uv_async_t, status: c_int) {
index f43cf72236109a82072ef58c12ceba3943cd8d2a..86c6c44238c060a3df3e0501e0225e04b2bb89df 100644 (file)
@@ -19,7 +19,7 @@
 use std::sync::arc::UnsafeArc;
 
 pub struct Refcount {
-    priv rc: UnsafeArc<uint>,
+    rc: UnsafeArc<uint>,
 }
 
 impl Refcount {
index f7bf2f051eb90c5029176b0e29f40bc3ebad3169..10d62a5aeae055639a9a66480ff7e2b4674e7ae4 100644 (file)
 // uv_stream_t instance, and all I/O operations assume that it's already located
 // on the appropriate scheduler.
 pub struct StreamWatcher {
-    handle: *uvll::uv_stream_t,
+    pub handle: *uvll::uv_stream_t,
 
     // Cache the last used uv_write_t so we don't have to allocate a new one on
     // every call to uv_write(). Ideally this would be a stack-allocated
     // structure, but currently we don't have mappings for all the structures
     // defined in libuv, so we're foced to malloc this.
-    priv last_write_req: Option<Request>,
+    last_write_req: Option<Request>,
 }
 
 struct ReadContext {
index 1621ccfbf454cf64b4c63379b0d77444fdf5d968..d8365cf677c173f2af308ef905c3db0f797c9c9f 100644 (file)
@@ -46,7 +46,7 @@
 
 // Obviously an Event Loop is always home.
 pub struct UvEventLoop {
-    priv uvio: UvIoFactory
+    uvio: UvIoFactory
 }
 
 impl UvEventLoop {
@@ -124,8 +124,8 @@ fn test_callback_run_once() {
 }
 
 pub struct UvIoFactory {
-    loop_: Loop,
-    priv handle_pool: Option<~QueuePool>,
+    pub loop_: Loop,
+    handle_pool: Option<~QueuePool>,
 }
 
 impl UvIoFactory {
index 578f90dee9aa7479fd7f01346699ae3a3a163278..62f1dbd73e3327c7c8a8798c144f9c79367581db 100644 (file)
@@ -100,15 +100,15 @@ pub mod errors {
 // see libuv/include/uv-unix.h
 #[cfg(unix)]
 pub struct uv_buf_t {
-    base: *u8,
-    len: uv_buf_len_t,
+    pub base: *u8,
+    pub len: uv_buf_len_t,
 }
 
 // see libuv/include/uv-win.h
 #[cfg(windows)]
 pub struct uv_buf_t {
-    len: uv_buf_len_t,
-    base: *u8,
+    pub len: uv_buf_len_t,
+    pub base: *u8,
 }
 
 #[repr(C)]
@@ -119,23 +119,23 @@ pub enum uv_run_mode {
 }
 
 pub struct uv_process_options_t {
-    exit_cb: uv_exit_cb,
-    file: *libc::c_char,
-    args: **libc::c_char,
-    env: **libc::c_char,
-    cwd: *libc::c_char,
-    flags: libc::c_uint,
-    stdio_count: libc::c_int,
-    stdio: *uv_stdio_container_t,
-    uid: uv_uid_t,
-    gid: uv_gid_t,
+    pub exit_cb: uv_exit_cb,
+    pub file: *libc::c_char,
+    pub args: **libc::c_char,
+    pub env: **libc::c_char,
+    pub cwd: *libc::c_char,
+    pub flags: libc::c_uint,
+    pub stdio_count: libc::c_int,
+    pub stdio: *uv_stdio_container_t,
+    pub uid: uv_uid_t,
+    pub gid: uv_gid_t,
 }
 
 // These fields are private because they must be interfaced with through the
 // functions below.
 pub struct uv_stdio_container_t {
-    priv flags: libc::c_int,
-    priv stream: *uv_stream_t,
+    flags: libc::c_int,
+    stream: *uv_stream_t,
 }
 
 pub type uv_handle_t = c_void;
@@ -160,27 +160,27 @@ pub struct uv_stdio_container_t {
 pub type uv_shutdown_t = c_void;
 
 pub struct uv_timespec_t {
-    tv_sec: libc::c_long,
-    tv_nsec: libc::c_long
+    pub tv_sec: libc::c_long,
+    pub tv_nsec: libc::c_long
 }
 
 pub struct uv_stat_t {
-    st_dev: libc::uint64_t,
-    st_mode: libc::uint64_t,
-    st_nlink: libc::uint64_t,
-    st_uid: libc::uint64_t,
-    st_gid: libc::uint64_t,
-    st_rdev: libc::uint64_t,
-    st_ino: libc::uint64_t,
-    st_size: libc::uint64_t,
-    st_blksize: libc::uint64_t,
-    st_blocks: libc::uint64_t,
-    st_flags: libc::uint64_t,
-    st_gen: libc::uint64_t,
-    st_atim: uv_timespec_t,
-    st_mtim: uv_timespec_t,
-    st_ctim: uv_timespec_t,
-    st_birthtim: uv_timespec_t
+    pub st_dev: libc::uint64_t,
+    pub st_mode: libc::uint64_t,
+    pub st_nlink: libc::uint64_t,
+    pub st_uid: libc::uint64_t,
+    pub st_gid: libc::uint64_t,
+    pub st_rdev: libc::uint64_t,
+    pub st_ino: libc::uint64_t,
+    pub st_size: libc::uint64_t,
+    pub st_blksize: libc::uint64_t,
+    pub st_blocks: libc::uint64_t,
+    pub st_flags: libc::uint64_t,
+    pub st_gen: libc::uint64_t,
+    pub st_atim: uv_timespec_t,
+    pub st_mtim: uv_timespec_t,
+    pub st_ctim: uv_timespec_t,
+    pub st_birthtim: uv_timespec_t
 }
 
 impl uv_stat_t {