From 60a29456ece193a2911968e790ead3eb01123339 Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 14 Apr 2020 00:08:57 +0200 Subject: [PATCH] libasync: change TcpStream::listen() callback constraint from Copy to Clone --- libasync/src/smoltcp/tcp_stream.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libasync/src/smoltcp/tcp_stream.rs b/libasync/src/smoltcp/tcp_stream.rs index 9d2e57c..4fed9ef 100644 --- a/libasync/src/smoltcp/tcp_stream.rs +++ b/libasync/src/smoltcp/tcp_stream.rs @@ -82,10 +82,11 @@ impl TcpStream { /// handshaking. Spawns additional tasks for each connection. pub fn listen(port: u16, rx_bufsize: usize, tx_bufsize: usize, backlog: usize, f: F) where - F: Fn(Self) -> R + Copy + 'static, + F: Fn(Self) -> R + Clone + 'static, R: Future + 'static, { for _ in 0..backlog { + let f = f.clone(); task::spawn(async move { loop { // Wait for new connection