native: Switch field privacy as necessary

This commit is contained in:
Alex Crichton
2014-03-27 15:10:28 -07:00
parent 5f33588d75
commit 14587f88ca
11 changed files with 39 additions and 37 deletions

View File

@@ -30,7 +30,7 @@ struct Inner {
} }
pub struct FileDesc { pub struct FileDesc {
priv inner: UnsafeArc<Inner> inner: UnsafeArc<Inner>
} }
impl FileDesc { impl FileDesc {
@@ -216,8 +216,8 @@ impl Drop for Inner {
} }
pub struct CFile { pub struct CFile {
priv file: *libc::FILE, file: *libc::FILE,
priv fd: FileDesc, fd: FileDesc,
} }
impl CFile { impl CFile {

View File

@@ -34,7 +34,7 @@ struct Inner {
} }
pub struct FileDesc { pub struct FileDesc {
priv inner: UnsafeArc<Inner> inner: UnsafeArc<Inner>
} }
impl FileDesc { impl FileDesc {

View File

@@ -215,7 +215,7 @@ fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
/// Implementation of rt::rtio's IoFactory trait to generate handles to the /// Implementation of rt::rtio's IoFactory trait to generate handles to the
/// native I/O functionality. /// native I/O functionality.
pub struct IoFactory { pub struct IoFactory {
priv cannot_construct_outside_of_this_module: () cannot_construct_outside_of_this_module: ()
} }
impl IoFactory { impl IoFactory {

View File

@@ -237,7 +237,7 @@ pub fn init() {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
pub struct TcpStream { pub struct TcpStream {
priv inner: UnsafeArc<Inner>, inner: UnsafeArc<Inner>,
} }
struct Inner { struct Inner {
@@ -373,7 +373,7 @@ impl Drop for Inner {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
pub struct TcpListener { pub struct TcpListener {
priv inner: UnsafeArc<Inner>, inner: UnsafeArc<Inner>,
} }
impl TcpListener { impl TcpListener {
@@ -430,7 +430,7 @@ impl rtio::RtioSocket for TcpListener {
} }
pub struct TcpAcceptor { pub struct TcpAcceptor {
priv listener: TcpListener, listener: TcpListener,
} }
impl TcpAcceptor { impl TcpAcceptor {
@@ -474,7 +474,7 @@ impl rtio::RtioTcpAcceptor for TcpAcceptor {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
pub struct UdpSocket { pub struct UdpSocket {
priv inner: UnsafeArc<Inner>, inner: UnsafeArc<Inner>,
} }
impl UdpSocket { impl UdpSocket {

View File

@@ -106,7 +106,7 @@ fn bind(addr: &CString, ty: libc::c_int) -> IoResult<Inner> {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
pub struct UnixStream { pub struct UnixStream {
priv inner: UnsafeArc<Inner>, inner: UnsafeArc<Inner>,
} }
impl UnixStream { impl UnixStream {
@@ -160,7 +160,7 @@ impl rtio::RtioPipe for UnixStream {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
pub struct UnixDatagram { pub struct UnixDatagram {
priv inner: UnsafeArc<Inner>, inner: UnsafeArc<Inner>,
} }
impl UnixDatagram { impl UnixDatagram {
@@ -231,7 +231,7 @@ impl UnixDatagram {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
pub struct UnixListener { pub struct UnixListener {
priv inner: Inner, inner: Inner,
} }
impl UnixListener { impl UnixListener {
@@ -256,7 +256,7 @@ impl rtio::RtioUnixListener for UnixListener {
} }
pub struct UnixAcceptor { pub struct UnixAcceptor {
priv listener: UnixListener, listener: UnixListener,
} }
impl UnixAcceptor { impl UnixAcceptor {

View File

@@ -154,9 +154,9 @@ unsafe fn pipe(name: *u16, init: bool) -> libc::HANDLE {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
pub struct UnixStream { pub struct UnixStream {
priv inner: UnsafeArc<Inner>, inner: UnsafeArc<Inner>,
priv write: Option<Event>, write: Option<Event>,
priv read: Option<Event>, read: Option<Event>,
} }
impl UnixStream { impl UnixStream {
@@ -349,8 +349,8 @@ impl rtio::RtioPipe for UnixStream {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
pub struct UnixListener { pub struct UnixListener {
priv handle: libc::HANDLE, handle: libc::HANDLE,
priv name: CString, name: CString,
} }
impl UnixListener { impl UnixListener {
@@ -389,8 +389,8 @@ impl rtio::RtioUnixListener for UnixListener {
} }
pub struct UnixAcceptor { pub struct UnixAcceptor {
priv listener: UnixListener, listener: UnixListener,
priv event: Event, event: Event,
} }
impl UnixAcceptor { impl UnixAcceptor {

View File

@@ -31,15 +31,15 @@ use super::file;
*/ */
pub struct Process { pub struct Process {
/// The unique id of the process (this should never be negative). /// The unique id of the process (this should never be negative).
priv pid: pid_t, pid: pid_t,
/// A handle to the process - on unix this will always be NULL, but on /// A handle to the process - on unix this will always be NULL, but on
/// windows it will be a HANDLE to the process, which will prevent the /// windows it will be a HANDLE to the process, which will prevent the
/// pid being re-used until the handle is closed. /// pid being re-used until the handle is closed.
priv handle: *(), handle: *(),
/// None until finish() is called. /// None until finish() is called.
priv exit_code: Option<p::ProcessExit>, exit_code: Option<p::ProcessExit>,
} }
impl Process { impl Process {

View File

@@ -59,8 +59,8 @@ use io::IoResult;
use io::timer_helper; use io::timer_helper;
pub struct Timer { pub struct Timer {
priv id: uint, id: uint,
priv inner: Option<~Inner>, inner: Option<~Inner>,
} }
struct Inner { struct Inner {

View File

@@ -40,8 +40,8 @@ use io::IoResult;
use io::timer_helper; use io::timer_helper;
pub struct Timer { pub struct Timer {
priv fd: FileDesc, fd: FileDesc,
priv on_worker: bool, on_worker: bool,
} }
#[allow(visible_private_types)] #[allow(visible_private_types)]
@@ -285,24 +285,24 @@ mod imp {
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
#[packed] #[packed]
pub struct epoll_event { pub struct epoll_event {
events: u32, pub events: u32,
data: i64, pub data: i64,
} }
#[cfg(not(target_arch = "x86_64"))] #[cfg(not(target_arch = "x86_64"))]
pub struct epoll_event { pub struct epoll_event {
events: u32, pub events: u32,
data: i64, pub data: i64,
} }
pub struct timespec { pub struct timespec {
tv_sec: libc::time_t, pub tv_sec: libc::time_t,
tv_nsec: libc::c_long, pub tv_nsec: libc::c_long,
} }
pub struct itimerspec { pub struct itimerspec {
it_interval: timespec, pub it_interval: timespec,
it_value: timespec, pub it_value: timespec,
} }
extern { extern {

View File

@@ -29,8 +29,8 @@ use io::timer_helper;
use io::IoResult; use io::IoResult;
pub struct Timer { pub struct Timer {
priv obj: libc::HANDLE, obj: libc::HANDLE,
priv on_worker: bool, on_worker: bool,
} }
pub enum Req { pub enum Req {

View File

@@ -51,6 +51,8 @@
#![deny(unused_result, unused_must_use)] #![deny(unused_result, unused_must_use)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
// NB this crate explicitly does *not* allow glob imports, please seriously // NB this crate explicitly does *not* allow glob imports, please seriously
// consider whether they're needed before adding that feature here (the // consider whether they're needed before adding that feature here (the
// answer is that you don't need them) // answer is that you don't need them)