about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorEric Reed <ecreed@cs.washington.edu>2013-08-27 10:01:17 -0700
committerEric Reed <ecreed@cs.washington.edu>2013-06-23 00:03:11 -0700
commit58b2ff9f564833f5f4fa077a5708c139738dad8e (patch)
tree04561298feb219db737a5b382059092fa03552f9 /src/rustllvm/RustWrapper.cpp
parentefb8924f8848f39811a8e69db182effb465ad3cf (diff)
downloadrust-58b2ff9f564833f5f4fa077a5708c139738dad8e.tar.gz
rust-58b2ff9f564833f5f4fa077a5708c139738dad8e.zip
Split out starting a listener from accepting incoming connections.
The Listener trait takes two type parameters, the type of connection and the type of Acceptor,
and specifies only one method, listen, which consumes the listener and produces an Acceptor.

The Acceptor trait takes one type parameter, the type of connection, and defines two methods.
The accept() method waits for an incoming connection attempt and returns the result.
The incoming() method creates an iterator over incoming connections and is a default method.

Example:

let listener = TcpListener.bind(addr); // Bind to a socket
let acceptor = listener.listen(); // Start the listener
for stream in acceptor.incoming() {
    // Process incoming connections forever (or until you break out of the loop)
}
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions