auto merge of #14900 : alexcrichton/rust/snapshots, r=huonw
Closes #14898 Closes #14918
This commit is contained in:
commit
7ec78053ec
94 changed files with 321 additions and 841 deletions
|
|
@ -168,8 +168,8 @@ impl rtio::RtioPipe for FileDesc {
|
|||
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
self.inner_write(buf)
|
||||
}
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe:Send>
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
// Only supported on named pipes currently. Note that this doesn't have an
|
||||
|
|
|
|||
|
|
@ -201,8 +201,8 @@ impl rtio::RtioPipe for FileDesc {
|
|||
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
self.inner_write(buf)
|
||||
}
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe:Send>
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box FileDesc { inner: self.inner.clone() } as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
// Only supported on named pipes currently. Note that this doesn't have an
|
||||
|
|
|
|||
|
|
@ -167,34 +167,34 @@ impl rtio::IoFactory for IoFactory {
|
|||
// networking
|
||||
fn tcp_connect(&mut self, addr: rtio::SocketAddr,
|
||||
timeout: Option<u64>)
|
||||
-> IoResult<Box<rtio::RtioTcpStream:Send>>
|
||||
-> IoResult<Box<rtio::RtioTcpStream + Send>>
|
||||
{
|
||||
net::TcpStream::connect(addr, timeout).map(|s| {
|
||||
box s as Box<rtio::RtioTcpStream:Send>
|
||||
box s as Box<rtio::RtioTcpStream + Send>
|
||||
})
|
||||
}
|
||||
fn tcp_bind(&mut self, addr: rtio::SocketAddr)
|
||||
-> IoResult<Box<rtio::RtioTcpListener:Send>> {
|
||||
-> IoResult<Box<rtio::RtioTcpListener + Send>> {
|
||||
net::TcpListener::bind(addr).map(|s| {
|
||||
box s as Box<rtio::RtioTcpListener:Send>
|
||||
box s as Box<rtio::RtioTcpListener + Send>
|
||||
})
|
||||
}
|
||||
fn udp_bind(&mut self, addr: rtio::SocketAddr)
|
||||
-> IoResult<Box<rtio::RtioUdpSocket:Send>> {
|
||||
-> IoResult<Box<rtio::RtioUdpSocket + Send>> {
|
||||
net::UdpSocket::bind(addr).map(|u| {
|
||||
box u as Box<rtio::RtioUdpSocket:Send>
|
||||
box u as Box<rtio::RtioUdpSocket + Send>
|
||||
})
|
||||
}
|
||||
fn unix_bind(&mut self, path: &CString)
|
||||
-> IoResult<Box<rtio::RtioUnixListener:Send>> {
|
||||
-> IoResult<Box<rtio::RtioUnixListener + Send>> {
|
||||
pipe::UnixListener::bind(path).map(|s| {
|
||||
box s as Box<rtio::RtioUnixListener:Send>
|
||||
box s as Box<rtio::RtioUnixListener + Send>
|
||||
})
|
||||
}
|
||||
fn unix_connect(&mut self, path: &CString,
|
||||
timeout: Option<u64>) -> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
timeout: Option<u64>) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
pipe::UnixStream::connect(path, timeout).map(|s| {
|
||||
box s as Box<rtio::RtioPipe:Send>
|
||||
box s as Box<rtio::RtioPipe + Send>
|
||||
})
|
||||
}
|
||||
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
|
||||
|
|
@ -206,18 +206,18 @@ impl rtio::IoFactory for IoFactory {
|
|||
|
||||
// filesystem operations
|
||||
fn fs_from_raw_fd(&mut self, fd: c_int, close: rtio::CloseBehavior)
|
||||
-> Box<rtio::RtioFileStream:Send> {
|
||||
-> Box<rtio::RtioFileStream + Send> {
|
||||
let close = match close {
|
||||
rtio::CloseSynchronously | rtio::CloseAsynchronously => true,
|
||||
rtio::DontClose => false
|
||||
};
|
||||
box file::FileDesc::new(fd, close) as Box<rtio::RtioFileStream:Send>
|
||||
box file::FileDesc::new(fd, close) as Box<rtio::RtioFileStream + Send>
|
||||
}
|
||||
fn fs_open(&mut self, path: &CString, fm: rtio::FileMode,
|
||||
fa: rtio::FileAccess)
|
||||
-> IoResult<Box<rtio::RtioFileStream:Send>>
|
||||
-> IoResult<Box<rtio::RtioFileStream + Send>>
|
||||
{
|
||||
file::open(path, fm, fa).map(|fd| box fd as Box<rtio::RtioFileStream:Send>)
|
||||
file::open(path, fm, fa).map(|fd| box fd as Box<rtio::RtioFileStream + Send>)
|
||||
}
|
||||
fn fs_unlink(&mut self, path: &CString) -> IoResult<()> {
|
||||
file::unlink(path)
|
||||
|
|
@ -261,31 +261,31 @@ impl rtio::IoFactory for IoFactory {
|
|||
}
|
||||
|
||||
// misc
|
||||
fn timer_init(&mut self) -> IoResult<Box<rtio::RtioTimer:Send>> {
|
||||
timer::Timer::new().map(|t| box t as Box<rtio::RtioTimer:Send>)
|
||||
fn timer_init(&mut self) -> IoResult<Box<rtio::RtioTimer + Send>> {
|
||||
timer::Timer::new().map(|t| box t as Box<rtio::RtioTimer + Send>)
|
||||
}
|
||||
fn spawn(&mut self, cfg: rtio::ProcessConfig)
|
||||
-> IoResult<(Box<rtio::RtioProcess:Send>,
|
||||
Vec<Option<Box<rtio::RtioPipe:Send>>>)> {
|
||||
-> IoResult<(Box<rtio::RtioProcess + Send>,
|
||||
Vec<Option<Box<rtio::RtioPipe + Send>>>)> {
|
||||
process::Process::spawn(cfg).map(|(p, io)| {
|
||||
(box p as Box<rtio::RtioProcess:Send>,
|
||||
(box p as Box<rtio::RtioProcess + Send>,
|
||||
io.move_iter().map(|p| p.map(|p| {
|
||||
box p as Box<rtio::RtioPipe:Send>
|
||||
box p as Box<rtio::RtioPipe + Send>
|
||||
})).collect())
|
||||
})
|
||||
}
|
||||
fn kill(&mut self, pid: libc::pid_t, signum: int) -> IoResult<()> {
|
||||
process::Process::kill(pid, signum)
|
||||
}
|
||||
fn pipe_open(&mut self, fd: c_int) -> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
Ok(box file::FileDesc::new(fd, true) as Box<rtio::RtioPipe:Send>)
|
||||
fn pipe_open(&mut self, fd: c_int) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
Ok(box file::FileDesc::new(fd, true) as Box<rtio::RtioPipe + Send>)
|
||||
}
|
||||
fn tty_open(&mut self, fd: c_int, _readable: bool)
|
||||
-> IoResult<Box<rtio::RtioTTY:Send>> {
|
||||
-> IoResult<Box<rtio::RtioTTY + Send>> {
|
||||
#[cfg(unix)] use ERROR = libc::ENOTTY;
|
||||
#[cfg(windows)] use ERROR = libc::ERROR_INVALID_HANDLE;
|
||||
if unsafe { libc::isatty(fd) } != 0 {
|
||||
Ok(box file::FileDesc::new(fd, true) as Box<rtio::RtioTTY:Send>)
|
||||
Ok(box file::FileDesc::new(fd, true) as Box<rtio::RtioTTY + Send>)
|
||||
} else {
|
||||
Err(IoError {
|
||||
code: ERROR as uint,
|
||||
|
|
@ -295,7 +295,7 @@ impl rtio::IoFactory for IoFactory {
|
|||
}
|
||||
}
|
||||
fn signal(&mut self, _signal: int, _cb: Box<rtio::Callback>)
|
||||
-> IoResult<Box<rtio::RtioSignal:Send>> {
|
||||
-> IoResult<Box<rtio::RtioSignal + Send>> {
|
||||
Err(unimpl())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -397,12 +397,12 @@ impl rtio::RtioTcpStream for TcpStream {
|
|||
self.set_keepalive(None)
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioTcpStream:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioTcpStream + Send> {
|
||||
box TcpStream {
|
||||
inner: self.inner.clone(),
|
||||
read_deadline: 0,
|
||||
write_deadline: 0,
|
||||
} as Box<rtio::RtioTcpStream:Send>
|
||||
} as Box<rtio::RtioTcpStream + Send>
|
||||
}
|
||||
|
||||
fn close_write(&mut self) -> IoResult<()> {
|
||||
|
|
@ -484,9 +484,9 @@ impl TcpListener {
|
|||
}
|
||||
|
||||
impl rtio::RtioTcpListener for TcpListener {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioTcpAcceptor:Send>> {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioTcpAcceptor + Send>> {
|
||||
self.native_listen(128).map(|a| {
|
||||
box a as Box<rtio::RtioTcpAcceptor:Send>
|
||||
box a as Box<rtio::RtioTcpAcceptor + Send>
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -533,8 +533,8 @@ impl rtio::RtioSocket for TcpAcceptor {
|
|||
}
|
||||
|
||||
impl rtio::RtioTcpAcceptor for TcpAcceptor {
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioTcpStream:Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioTcpStream:Send>)
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioTcpStream + Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioTcpStream + Send>)
|
||||
}
|
||||
|
||||
fn accept_simultaneously(&mut self) -> IoResult<()> { Ok(()) }
|
||||
|
|
@ -720,12 +720,12 @@ impl rtio::RtioUdpSocket for UdpSocket {
|
|||
self.set_broadcast(false)
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioUdpSocket:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioUdpSocket + Send> {
|
||||
box UdpSocket {
|
||||
inner: self.inner.clone(),
|
||||
read_deadline: 0,
|
||||
write_deadline: 0,
|
||||
} as Box<rtio::RtioUdpSocket:Send>
|
||||
} as Box<rtio::RtioUdpSocket + Send>
|
||||
}
|
||||
|
||||
fn set_timeout(&mut self, timeout: Option<u64>) {
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ impl rtio::RtioPipe for UnixStream {
|
|||
}
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
box UnixStream::new(self.inner.clone()) as Box<rtio::RtioPipe:Send>
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box UnixStream::new(self.inner.clone()) as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
fn close_write(&mut self) -> IoResult<()> {
|
||||
|
|
@ -229,9 +229,9 @@ impl UnixListener {
|
|||
}
|
||||
|
||||
impl rtio::RtioUnixListener for UnixListener {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor:Send>> {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor + Send>> {
|
||||
self.native_listen(128).map(|a| {
|
||||
box a as Box<rtio::RtioUnixAcceptor:Send>
|
||||
box a as Box<rtio::RtioUnixAcceptor + Send>
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -264,8 +264,8 @@ impl UnixAcceptor {
|
|||
}
|
||||
|
||||
impl rtio::RtioUnixAcceptor for UnixAcceptor {
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioPipe:Send>)
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioPipe + Send>)
|
||||
}
|
||||
fn set_timeout(&mut self, timeout: Option<u64>) {
|
||||
self.deadline = timeout.map(|a| ::io::timer::now() + a).unwrap_or(0);
|
||||
|
|
|
|||
|
|
@ -496,14 +496,14 @@ impl rtio::RtioPipe for UnixStream {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn clone(&self) -> Box<rtio::RtioPipe:Send> {
|
||||
fn clone(&self) -> Box<rtio::RtioPipe + Send> {
|
||||
box UnixStream {
|
||||
inner: self.inner.clone(),
|
||||
read: None,
|
||||
write: None,
|
||||
read_deadline: 0,
|
||||
write_deadline: 0,
|
||||
} as Box<rtio::RtioPipe:Send>
|
||||
} as Box<rtio::RtioPipe + Send>
|
||||
}
|
||||
|
||||
fn close_read(&mut self) -> IoResult<()> {
|
||||
|
|
@ -588,9 +588,9 @@ impl Drop for UnixListener {
|
|||
}
|
||||
|
||||
impl rtio::RtioUnixListener for UnixListener {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor:Send>> {
|
||||
fn listen(~self) -> IoResult<Box<rtio::RtioUnixAcceptor + Send>> {
|
||||
self.native_listen().map(|a| {
|
||||
box a as Box<rtio::RtioUnixAcceptor:Send>
|
||||
box a as Box<rtio::RtioUnixAcceptor + Send>
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -702,8 +702,8 @@ impl UnixAcceptor {
|
|||
}
|
||||
|
||||
impl rtio::RtioUnixAcceptor for UnixAcceptor {
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe:Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioPipe:Send>)
|
||||
fn accept(&mut self) -> IoResult<Box<rtio::RtioPipe + Send>> {
|
||||
self.native_accept().map(|s| box s as Box<rtio::RtioPipe + Send>)
|
||||
}
|
||||
fn set_timeout(&mut self, timeout: Option<u64>) {
|
||||
self.deadline = timeout.map(|i| i + ::io::timer::now()).unwrap_or(0);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ pub struct Timer {
|
|||
}
|
||||
|
||||
struct Inner {
|
||||
cb: Option<Box<rtio::Callback:Send>>,
|
||||
cb: Option<Box<rtio::Callback + Send>>,
|
||||
interval: u64,
|
||||
repeat: bool,
|
||||
target: u64,
|
||||
|
|
@ -266,7 +266,7 @@ impl rtio::RtioTimer for Timer {
|
|||
Timer::sleep(msecs);
|
||||
}
|
||||
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<rtio::Callback:Send>) {
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<rtio::Callback + Send>) {
|
||||
let now = now();
|
||||
let mut inner = self.inner();
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ impl rtio::RtioTimer for Timer {
|
|||
unsafe { HELPER.send(NewTimer(inner)); }
|
||||
}
|
||||
|
||||
fn period(&mut self, msecs: u64, cb: Box<rtio::Callback:Send>) {
|
||||
fn period(&mut self, msecs: u64, cb: Box<rtio::Callback + Send>) {
|
||||
let now = now();
|
||||
let mut inner = self.inner();
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ pub struct Timer {
|
|||
}
|
||||
|
||||
pub enum Req {
|
||||
NewTimer(libc::HANDLE, Box<Callback:Send>, bool),
|
||||
NewTimer(libc::HANDLE, Box<Callback + Send>, bool),
|
||||
RemoveTimer(libc::HANDLE, Sender<()>),
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ impl rtio::RtioTimer for Timer {
|
|||
let _ = unsafe { imp::WaitForSingleObject(self.obj, libc::INFINITE) };
|
||||
}
|
||||
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<Callback:Send>) {
|
||||
fn oneshot(&mut self, msecs: u64, cb: Box<Callback + Send>) {
|
||||
self.remove();
|
||||
|
||||
// see above for the calculation
|
||||
|
|
@ -162,7 +162,7 @@ impl rtio::RtioTimer for Timer {
|
|||
self.on_worker = true;
|
||||
}
|
||||
|
||||
fn period(&mut self, msecs: u64, cb: Box<Callback:Send>) {
|
||||
fn period(&mut self, msecs: u64, cb: Box<Callback + Send>) {
|
||||
self.remove();
|
||||
|
||||
// see above for the calculation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue