about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-10-17 12:13:29 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-10-24 14:21:57 -0700
commit4ce71eaca34526d0e3ee1ebf0658d2a20d388ef2 (patch)
tree440d109c6f23dd446573195828c1ebbf2d261994
parent59d45b8fe793d369ddf600cce0f212f9b6165a30 (diff)
downloadrust-4ce71eaca34526d0e3ee1ebf0658d2a20d388ef2.tar.gz
rust-4ce71eaca34526d0e3ee1ebf0658d2a20d388ef2.zip
Migrate the last typedefs to ~Trait in rtio
There are no longer any remnants of typedefs, and everything is now built on
true trait objects.
-rw-r--r--src/libstd/rt/io/net/tcp.rs4
-rw-r--r--src/libstd/rt/io/net/unix.rs4
-rw-r--r--src/libstd/rt/rtio.rs13
-rw-r--r--src/libstd/rt/uv/uvio.rs12
4 files changed, 14 insertions, 19 deletions
diff --git a/src/libstd/rt/io/net/tcp.rs b/src/libstd/rt/io/net/tcp.rs
index bafde180d5c..21f98c27296 100644
--- a/src/libstd/rt/io/net/tcp.rs
+++ b/src/libstd/rt/io/net/tcp.rs
@@ -13,7 +13,7 @@ use result::{Ok, Err};
 use rt::io::net::ip::SocketAddr;
 use rt::io::{Reader, Writer, Listener, Acceptor};
 use rt::io::{io_error, read_error, EndOfFile};
-use rt::rtio::{IoFactory, RtioTcpListenerObject, with_local_io,
+use rt::rtio::{IoFactory, with_local_io,
                RtioSocket, RtioTcpListener, RtioTcpAcceptor, RtioTcpStream};
 
 pub struct TcpStream {
@@ -89,7 +89,7 @@ impl Writer for TcpStream {
 }
 
 pub struct TcpListener {
-    priv obj: ~RtioTcpListenerObject
+    priv obj: ~RtioTcpListener
 }
 
 impl TcpListener {
diff --git a/src/libstd/rt/io/net/unix.rs b/src/libstd/rt/io/net/unix.rs
index b98d5b52cb2..fc7839d545f 100644
--- a/src/libstd/rt/io/net/unix.rs
+++ b/src/libstd/rt/io/net/unix.rs
@@ -26,7 +26,7 @@ use prelude::*;
 
 use c_str::ToCStr;
 use rt::rtio::{IoFactory, RtioUnixListener, with_local_io};
-use rt::rtio::{RtioUnixAcceptor, RtioPipe, RtioUnixListenerObject};
+use rt::rtio::{RtioUnixAcceptor, RtioPipe};
 use rt::io::pipe::PipeStream;
 use rt::io::{io_error, Listener, Acceptor, Reader, Writer};
 
@@ -82,7 +82,7 @@ impl Writer for UnixStream {
 }
 
 pub struct UnixListener {
-    priv obj: ~RtioUnixListenerObject,
+    priv obj: ~RtioUnixListener,
 }
 
 impl UnixListener {
diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs
index 924d9c4bff1..c779be01046 100644
--- a/src/libstd/rt/rtio.rs
+++ b/src/libstd/rt/rtio.rs
@@ -18,15 +18,10 @@ use ai = rt::io::net::addrinfo;
 use rt::io::IoError;
 use super::io::process::ProcessConfig;
 use super::io::net::ip::{IpAddr, SocketAddr};
-use rt::uv::uvio;
 use path::Path;
 use super::io::{SeekStyle};
 use super::io::{FileMode, FileAccess, FileStat};
 
-// FIXME(#9893) cannot call by-value self method on a trait object
-pub type RtioTcpListenerObject = uvio::UvTcpListener;
-pub type RtioUnixListenerObject = uvio::UvUnixListener;
-
 pub trait EventLoop {
     fn run(&mut self);
     fn callback(&mut self, ~fn());
@@ -82,7 +77,7 @@ pub fn with_local_io<T>(f: &fn(&mut IoFactory) -> Option<T>) -> Option<T> {
 
 pub trait IoFactory {
     fn tcp_connect(&mut self, addr: SocketAddr) -> Result<~RtioTcpStream, IoError>;
-    fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~RtioTcpListenerObject, IoError>;
+    fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~RtioTcpListener, IoError>;
     fn udp_bind(&mut self, addr: SocketAddr) -> Result<~RtioUdpSocket, IoError>;
     fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
                           hint: Option<ai::Hint>) -> Result<~[ai::Info], IoError>;
@@ -100,14 +95,14 @@ pub trait IoFactory {
             -> Result<(~RtioProcess, ~[Option<~RtioPipe>]), IoError>;
 
     fn unix_bind(&mut self, path: &CString) ->
-        Result<~RtioUnixListenerObject, IoError>;
+        Result<~RtioUnixListener, IoError>;
     fn unix_connect(&mut self, path: &CString) -> Result<~RtioPipe, IoError>;
     fn tty_open(&mut self, fd: c_int, readable: bool, close_on_drop: bool)
             -> Result<~RtioTTY, IoError>;
 }
 
 pub trait RtioTcpListener : RtioSocket {
-    fn listen(self) -> Result<~RtioTcpAcceptor, IoError>;
+    fn listen(~self) -> Result<~RtioTcpAcceptor, IoError>;
 }
 
 pub trait RtioTcpAcceptor : RtioSocket {
@@ -173,7 +168,7 @@ pub trait RtioPipe {
 }
 
 pub trait RtioUnixListener {
-    fn listen(self) -> Result<~RtioUnixAcceptor, IoError>;
+    fn listen(~self) -> Result<~RtioUnixAcceptor, IoError>;
 }
 
 pub trait RtioUnixAcceptor {
diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs
index 3858b64915a..322588973ae 100644
--- a/src/libstd/rt/uv/uvio.rs
+++ b/src/libstd/rt/uv/uvio.rs
@@ -493,12 +493,12 @@ impl IoFactory for UvIoFactory {
         return result_cell.take();
     }
 
-    fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~RtioTcpListenerObject, IoError> {
+    fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~RtioTcpListener, IoError> {
         let mut watcher = TcpWatcher::new(self.uv_loop());
         match watcher.bind(addr) {
             Ok(_) => {
                 let home = get_handle_to_current_scheduler!();
-                Ok(~UvTcpListener::new(watcher, home))
+                Ok(~UvTcpListener::new(watcher, home) as ~RtioTcpListener)
             }
             Err(uverr) => {
                 do task::unkillable { // FIXME(#8674)
@@ -804,13 +804,13 @@ impl IoFactory for UvIoFactory {
     }
 
     fn unix_bind(&mut self, path: &CString) ->
-        Result<~RtioUnixListenerObject, IoError> {
+        Result<~RtioUnixListener, IoError> {
         let mut pipe = Pipe::new(self.uv_loop(), false);
         match pipe.bind(path) {
             Ok(()) => {
                 let handle = get_handle_to_current_scheduler!();
                 let pipe = UvUnboundPipe::new(pipe, handle);
-                Ok(~UvUnixListener::new(pipe))
+                Ok(~UvUnixListener::new(pipe) as ~RtioUnixListener)
             }
             Err(e) => {
                 let scheduler: ~Scheduler = Local::take();
@@ -919,7 +919,7 @@ impl RtioSocket for UvTcpListener {
 }
 
 impl RtioTcpListener for UvTcpListener {
-    fn listen(self) -> Result<~RtioTcpAcceptor, IoError> {
+    fn listen(~self) -> Result<~RtioTcpAcceptor, IoError> {
         do self.home_for_io_consume |self_| {
             let acceptor = ~UvTcpAcceptor::new(self_);
             let incoming = Cell::new(acceptor.incoming.clone());
@@ -1717,7 +1717,7 @@ impl UvUnixListener {
 }
 
 impl RtioUnixListener for UvUnixListener {
-    fn listen(self) -> Result<~RtioUnixAcceptor, IoError> {
+    fn listen(~self) -> Result<~RtioUnixAcceptor, IoError> {
         do self.home_for_io_consume |self_| {
             let acceptor = ~UvUnixAcceptor::new(self_);
             let incoming = Cell::new(acceptor.incoming.clone());