diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-04-22 13:26:37 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-04-22 13:26:37 -0700 |
| commit | 6644a034f0650c638eea8809a5f035ffaca0de88 (patch) | |
| tree | 36f39a524f46eadb00dc8240df592f04f897d218 /src/libcore/rt | |
| parent | e5d21b9ff1ea4160b728b62aeca110c0a563d9ee (diff) | |
| download | rust-6644a034f0650c638eea8809a5f035ffaca0de88.tar.gz rust-6644a034f0650c638eea8809a5f035ffaca0de88.zip | |
core::rt: Move the definition of Listener to rt::io
Diffstat (limited to 'src/libcore/rt')
| -rw-r--r-- | src/libcore/rt/io/mod.rs | 24 | ||||
| -rw-r--r-- | src/libcore/rt/io/net/mod.rs | 31 |
2 files changed, 21 insertions, 34 deletions
diff --git a/src/libcore/rt/io/mod.rs b/src/libcore/rt/io/mod.rs index 238bd97a62d..f1b248c6e1d 100644 --- a/src/libcore/rt/io/mod.rs +++ b/src/libcore/rt/io/mod.rs @@ -122,7 +122,6 @@ pub use self::stdio::print; pub use self::stdio::println; pub use self::file::FileStream; -pub use self::net::Listener; pub use self::net::ip::IpAddr; pub use self::net::tcp::TcpListener; pub use self::net::tcp::TcpStream; @@ -137,8 +136,14 @@ pub use self::extensions::WriterByteConversions; pub mod file; /// Synchronous, non-blocking network I/O. -#[path = "net/mod.rs"] -pub mod net; +pub mod net { + pub mod tcp; + pub mod udp; + pub mod ip; + #[cfg(unix)] + pub mod unix; + pub mod http; +} /// Readers and Writers for memory buffers and strings. #[cfg(not(stage0))] // XXX Using unsnapshotted features @@ -280,6 +285,19 @@ pub trait Seek { fn seek(&mut self, pos: i64, style: SeekStyle); } +/// A listener is a value that listens for connections +pub trait Listener<S> { + /// Wait for and accept an incoming connection + /// + /// Returns `None` on timeout. + /// + /// # Failure + /// + /// Raises `io_error` condition. If the condition is handled, + /// then `accept` returns `None`. + fn accept(&mut self) -> Option<S>; +} + /// Common trait for decorator types. /// /// Provides accessors to get the inner, 'decorated' values. The I/O library diff --git a/src/libcore/rt/io/net/mod.rs b/src/libcore/rt/io/net/mod.rs deleted file mode 100644 index 130ff6b38fa..00000000000 --- a/src/libcore/rt/io/net/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use prelude::*; - -pub mod tcp; -pub mod udp; -pub mod ip; -#[cfg(unix)] -pub mod unix; -pub mod http; - -/// A listener is a value that listens for connections -pub trait Listener<S> { - /// Wait for and accept an incoming connection - /// - /// Returns `None` on timeout. - /// - /// # Failure - /// - /// Raises `io_error` condition. If the condition is handled, - /// then `accept` returns `None`. - fn accept(&mut self) -> Option<S>; -} |
