closure syntax

Signed-off-by: Peter Atashian <retep998@gmail.com>
This commit is contained in:
Peter Atashian 2015-01-06 05:33:40 -05:00
parent 39f0d597e8
commit b2a1f2a6b9

View file

@ -92,7 +92,7 @@ impl Connection<BufferedReader<NetStream>, BufferedWriter<NetStream>> {
}
/// Modifies the internal TcpStream using a function.
fn mod_stream(&self, f: |&mut TcpStream| -> IoResult<()>) -> IoResult<()> {
fn mod_stream<F>(&self, f: F) -> IoResult<()> where F: FnOnce(&mut TcpStream) -> IoResult<()> {
match self.reader.lock().unwrap().get_mut() {
&NetStream::UnsecuredTcpStream(ref mut tcp) => f(tcp),
#[cfg(feature = "ssl")]