Fix fallout of removing default bounds

This is all purely fallout of getting the previous commit to compile.
This commit is contained in:
Alex Crichton 2014-03-08 18:21:49 -08:00
parent bdd24b2a56
commit bb9172d7b5
61 changed files with 378 additions and 364 deletions

View file

@ -27,12 +27,12 @@ pub struct AsyncWatcher {
}
struct Payload {
callback: ~Callback,
callback: ~Callback:Send,
exit_flag: Exclusive<bool>,
}
impl AsyncWatcher {
pub fn new(loop_: &mut Loop, cb: ~Callback) -> AsyncWatcher {
pub fn new(loop_: &mut Loop, cb: ~Callback:Send) -> AsyncWatcher {
let handle = UvHandle::alloc(None::<AsyncWatcher>, uvll::UV_ASYNC);
assert_eq!(unsafe {
uvll::uv_async_init(loop_.handle, handle, async_cb)
@ -149,8 +149,7 @@ mod test_remote {
let (tx, rx) = channel();
let cb = ~MyCallback(Some(tx));
let watcher = AsyncWatcher::new(&mut local_loop().loop_,
cb as ~Callback);
let watcher = AsyncWatcher::new(&mut local_loop().loop_, cb);
let thread = Thread::start(proc() {
let mut watcher = watcher;

View file

@ -19,11 +19,11 @@ pub struct IdleWatcher {
handle: *uvll::uv_idle_t,
idle_flag: bool,
closed: bool,
callback: ~Callback,
callback: ~Callback:Send,
}
impl IdleWatcher {
pub fn new(loop_: &mut Loop, cb: ~Callback) -> ~IdleWatcher {
pub fn new(loop_: &mut Loop, cb: ~Callback:Send) -> ~IdleWatcher {
let handle = UvHandle::alloc(None::<IdleWatcher>, uvll::UV_IDLE);
assert_eq!(unsafe {
uvll::uv_idle_init(loop_.handle, handle)

View file

@ -126,8 +126,8 @@ pub mod stream;
/// // this code is running inside of a green task powered by libuv
/// }
/// ```
pub fn event_loop() -> ~rtio::EventLoop {
~uvio::UvEventLoop::new() as ~rtio::EventLoop
pub fn event_loop() -> ~rtio::EventLoop:Send {
~uvio::UvEventLoop::new() as ~rtio::EventLoop:Send
}
/// A type that wraps a uv handle

View file

@ -167,8 +167,8 @@ pub struct TcpListener {
home: HomeHandle,
handle: *uvll::uv_pipe_t,
priv closing_task: Option<BlockedTask>,
priv outgoing: Sender<Result<~rtio::RtioTcpStream, IoError>>,
priv incoming: Receiver<Result<~rtio::RtioTcpStream, IoError>>,
priv outgoing: Sender<Result<~rtio::RtioTcpStream:Send, IoError>>,
priv incoming: Receiver<Result<~rtio::RtioTcpStream:Send, IoError>>,
}
pub struct TcpAcceptor {
@ -295,7 +295,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
})
}
fn clone(&self) -> ~rtio::RtioTcpStream {
fn clone(&self) -> ~rtio::RtioTcpStream:Send {
~TcpWatcher {
handle: self.handle,
stream: StreamWatcher::new(self.handle),
@ -303,7 +303,7 @@ impl rtio::RtioTcpStream for TcpWatcher {
refcount: self.refcount.clone(),
write_access: self.write_access.clone(),
read_access: self.read_access.clone(),
} as ~rtio::RtioTcpStream
} as ~rtio::RtioTcpStream:Send
}
fn close_write(&mut self) -> Result<(), IoError> {
@ -397,14 +397,14 @@ impl rtio::RtioSocket for TcpListener {
}
impl rtio::RtioTcpListener for TcpListener {
fn listen(~self) -> Result<~rtio::RtioTcpAcceptor, IoError> {
fn listen(~self) -> Result<~rtio::RtioTcpAcceptor:Send, IoError> {
// create the acceptor object from ourselves
let mut acceptor = ~TcpAcceptor { listener: self };
let _m = acceptor.fire_homing_missile();
// FIXME: the 128 backlog should be configurable
match unsafe { uvll::uv_listen(acceptor.listener.handle, 128, listen_cb) } {
0 => Ok(acceptor as ~rtio::RtioTcpAcceptor),
0 => Ok(acceptor as ~rtio::RtioTcpAcceptor:Send),
n => Err(uv_error_to_io_error(UvError(n))),
}
}
@ -420,7 +420,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: c_int) {
});
let client = TcpWatcher::new_home(&loop_, tcp.home().clone());
assert_eq!(unsafe { uvll::uv_accept(server, client.handle) }, 0);
Ok(~client as ~rtio::RtioTcpStream)
Ok(~client as ~rtio::RtioTcpStream:Send)
}
n => Err(uv_error_to_io_error(UvError(n)))
};
@ -448,7 +448,7 @@ impl rtio::RtioSocket for TcpAcceptor {
}
impl rtio::RtioTcpAcceptor for TcpAcceptor {
fn accept(&mut self) -> Result<~rtio::RtioTcpStream, IoError> {
fn accept(&mut self) -> Result<~rtio::RtioTcpStream:Send, IoError> {
self.listener.incoming.recv()
}
@ -709,14 +709,14 @@ impl rtio::RtioUdpSocket for UdpWatcher {
})
}
fn clone(&self) -> ~rtio::RtioUdpSocket {
fn clone(&self) -> ~rtio::RtioUdpSocket:Send {
~UdpWatcher {
handle: self.handle,
home: self.home.clone(),
refcount: self.refcount.clone(),
write_access: self.write_access.clone(),
read_access: self.read_access.clone(),
} as ~rtio::RtioUdpSocket
} as ~rtio::RtioUdpSocket:Send
}
}

View file

@ -37,8 +37,8 @@ pub struct PipeWatcher {
pub struct PipeListener {
home: HomeHandle,
pipe: *uvll::uv_pipe_t,
priv outgoing: Sender<Result<~RtioPipe, IoError>>,
priv incoming: Receiver<Result<~RtioPipe, IoError>>,
priv outgoing: Sender<Result<~RtioPipe:Send, IoError>>,
priv incoming: Receiver<Result<~RtioPipe:Send, IoError>>,
}
pub struct PipeAcceptor {
@ -139,7 +139,7 @@ impl RtioPipe for PipeWatcher {
self.stream.write(buf).map_err(uv_error_to_io_error)
}
fn clone(&self) -> ~RtioPipe {
fn clone(&self) -> ~RtioPipe:Send {
~PipeWatcher {
stream: StreamWatcher::new(self.stream.handle),
defused: false,
@ -147,7 +147,7 @@ impl RtioPipe for PipeWatcher {
refcount: self.refcount.clone(),
read_access: self.read_access.clone(),
write_access: self.write_access.clone(),
} as ~RtioPipe
} as ~RtioPipe:Send
}
}
@ -197,14 +197,14 @@ impl PipeListener {
}
impl RtioUnixListener for PipeListener {
fn listen(~self) -> Result<~RtioUnixAcceptor, IoError> {
fn listen(~self) -> Result<~RtioUnixAcceptor:Send, IoError> {
// create the acceptor object from ourselves
let mut acceptor = ~PipeAcceptor { listener: self };
let _m = acceptor.fire_homing_missile();
// FIXME: the 128 backlog should be configurable
match unsafe { uvll::uv_listen(acceptor.listener.pipe, 128, listen_cb) } {
0 => Ok(acceptor as ~RtioUnixAcceptor),
0 => Ok(acceptor as ~RtioUnixAcceptor:Send),
n => Err(uv_error_to_io_error(UvError(n))),
}
}
@ -229,7 +229,7 @@ extern fn listen_cb(server: *uvll::uv_stream_t, status: libc::c_int) {
});
let client = PipeWatcher::new_home(&loop_, pipe.home().clone(), false);
assert_eq!(unsafe { uvll::uv_accept(server, client.handle()) }, 0);
Ok(~client as ~RtioPipe)
Ok(~client as ~RtioPipe:Send)
}
n => Err(uv_error_to_io_error(UvError(n)))
};
@ -246,7 +246,7 @@ impl Drop for PipeListener {
// PipeAcceptor implementation and traits
impl RtioUnixAcceptor for PipeAcceptor {
fn accept(&mut self) -> Result<~RtioPipe, IoError> {
fn accept(&mut self) -> Result<~RtioPipe:Send, IoError> {
self.listener.incoming.recv()
}
}

View file

@ -85,14 +85,17 @@ impl rtio::EventLoop for UvEventLoop {
IdleWatcher::onetime(&mut self.uvio.loop_, f);
}
fn pausable_idle_callback(&mut self, cb: ~rtio::Callback)
-> ~rtio::PausableIdleCallback
fn pausable_idle_callback(&mut self, cb: ~rtio::Callback:Send)
-> ~rtio::PausableIdleCallback:Send
{
IdleWatcher::new(&mut self.uvio.loop_, cb) as ~rtio::PausableIdleCallback
IdleWatcher::new(&mut self.uvio.loop_,
cb) as ~rtio::PausableIdleCallback:Send
}
fn remote_callback(&mut self, f: ~rtio::Callback) -> ~rtio::RemoteCallback {
~AsyncWatcher::new(&mut self.uvio.loop_, f) as ~rtio::RemoteCallback
fn remote_callback(&mut self, f: ~rtio::Callback:Send)
-> ~rtio::RemoteCallback:Send
{
~AsyncWatcher::new(&mut self.uvio.loop_, f) as ~rtio::RemoteCallback:Send
}
fn io<'a>(&'a mut self) -> Option<&'a mut rtio::IoFactory> {
@ -141,30 +144,30 @@ impl IoFactory for UvIoFactory {
// NB: This blocks the task waiting on the connection.
// It would probably be better to return a future
fn tcp_connect(&mut self, addr: SocketAddr)
-> Result<~rtio::RtioTcpStream, IoError>
-> Result<~rtio::RtioTcpStream:Send, IoError>
{
match TcpWatcher::connect(self, addr) {
Ok(t) => Ok(~t as ~rtio::RtioTcpStream),
Ok(t) => Ok(~t as ~rtio::RtioTcpStream:Send),
Err(e) => Err(uv_error_to_io_error(e)),
}
}
fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~rtio::RtioTcpListener, IoError> {
fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~rtio::RtioTcpListener:Send, IoError> {
match TcpListener::bind(self, addr) {
Ok(t) => Ok(t as ~rtio::RtioTcpListener),
Ok(t) => Ok(t as ~rtio::RtioTcpListener:Send),
Err(e) => Err(uv_error_to_io_error(e)),
}
}
fn udp_bind(&mut self, addr: SocketAddr) -> Result<~rtio::RtioUdpSocket, IoError> {
fn udp_bind(&mut self, addr: SocketAddr) -> Result<~rtio::RtioUdpSocket:Send, IoError> {
match UdpWatcher::bind(self, addr) {
Ok(u) => Ok(~u as ~rtio::RtioUdpSocket),
Ok(u) => Ok(~u as ~rtio::RtioUdpSocket:Send),
Err(e) => Err(uv_error_to_io_error(e)),
}
}
fn timer_init(&mut self) -> Result<~rtio::RtioTimer, IoError> {
Ok(TimerWatcher::new(self) as ~rtio::RtioTimer)
fn timer_init(&mut self) -> Result<~rtio::RtioTimer:Send, IoError> {
Ok(TimerWatcher::new(self) as ~rtio::RtioTimer:Send)
}
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
@ -174,12 +177,12 @@ impl IoFactory for UvIoFactory {
}
fn fs_from_raw_fd(&mut self, fd: c_int,
close: rtio::CloseBehavior) -> ~rtio::RtioFileStream {
~FileWatcher::new(self, fd, close) as ~rtio::RtioFileStream
close: rtio::CloseBehavior) -> ~rtio::RtioFileStream:Send {
~FileWatcher::new(self, fd, close) as ~rtio::RtioFileStream:Send
}
fn fs_open(&mut self, path: &CString, fm: FileMode, fa: FileAccess)
-> Result<~rtio::RtioFileStream, IoError> {
-> Result<~rtio::RtioFileStream:Send, IoError> {
let flags = match fm {
io::Open => 0,
io::Append => libc::O_APPEND,
@ -195,7 +198,7 @@ impl IoFactory for UvIoFactory {
};
match FsRequest::open(self, path, flags as int, mode as int) {
Ok(fs) => Ok(~fs as ~rtio::RtioFileStream),
Ok(fs) => Ok(~fs as ~rtio::RtioFileStream:Send),
Err(e) => Err(uv_error_to_io_error(e))
}
}
@ -260,12 +263,12 @@ impl IoFactory for UvIoFactory {
}
fn spawn(&mut self, config: ProcessConfig)
-> Result<(~rtio::RtioProcess, ~[Option<~rtio::RtioPipe>]), IoError>
-> Result<(~rtio::RtioProcess:Send, ~[Option<~rtio::RtioPipe:Send>]), IoError>
{
match Process::spawn(self, config) {
Ok((p, io)) => {
Ok((p as ~rtio::RtioProcess,
io.move_iter().map(|i| i.map(|p| ~p as ~rtio::RtioPipe)).collect()))
Ok((p as ~rtio::RtioProcess:Send,
io.move_iter().map(|i| i.map(|p| ~p as ~rtio::RtioPipe:Send)).collect()))
}
Err(e) => Err(uv_error_to_io_error(e)),
}
@ -275,40 +278,40 @@ impl IoFactory for UvIoFactory {
Process::kill(pid, signum).map_err(uv_error_to_io_error)
}
fn unix_bind(&mut self, path: &CString) -> Result<~rtio::RtioUnixListener, IoError>
fn unix_bind(&mut self, path: &CString) -> Result<~rtio::RtioUnixListener:Send, IoError>
{
match PipeListener::bind(self, path) {
Ok(p) => Ok(p as ~rtio::RtioUnixListener),
Ok(p) => Ok(p as ~rtio::RtioUnixListener:Send),
Err(e) => Err(uv_error_to_io_error(e)),
}
}
fn unix_connect(&mut self, path: &CString) -> Result<~rtio::RtioPipe, IoError> {
fn unix_connect(&mut self, path: &CString) -> Result<~rtio::RtioPipe:Send, IoError> {
match PipeWatcher::connect(self, path) {
Ok(p) => Ok(~p as ~rtio::RtioPipe),
Ok(p) => Ok(~p as ~rtio::RtioPipe:Send),
Err(e) => Err(uv_error_to_io_error(e)),
}
}
fn tty_open(&mut self, fd: c_int, readable: bool)
-> Result<~rtio::RtioTTY, IoError> {
-> Result<~rtio::RtioTTY:Send, IoError> {
match TtyWatcher::new(self, fd, readable) {
Ok(tty) => Ok(~tty as ~rtio::RtioTTY),
Ok(tty) => Ok(~tty as ~rtio::RtioTTY:Send),
Err(e) => Err(uv_error_to_io_error(e))
}
}
fn pipe_open(&mut self, fd: c_int) -> Result<~rtio::RtioPipe, IoError> {
fn pipe_open(&mut self, fd: c_int) -> Result<~rtio::RtioPipe:Send, IoError> {
match PipeWatcher::open(self, fd) {
Ok(s) => Ok(~s as ~rtio::RtioPipe),
Ok(s) => Ok(~s as ~rtio::RtioPipe:Send),
Err(e) => Err(uv_error_to_io_error(e))
}
}
fn signal(&mut self, signum: Signum, channel: Sender<Signum>)
-> Result<~rtio::RtioSignal, IoError> {
-> Result<~rtio::RtioSignal:Send, IoError> {
match SignalWatcher::new(self, signum, channel) {
Ok(s) => Ok(s as ~rtio::RtioSignal),
Ok(s) => Ok(s as ~rtio::RtioSignal:Send),
Err(e) => Err(uv_error_to_io_error(e)),
}
}