libasync: change TcpStream::listen() callback constraint from Copy to Clone

tcp-recv-fnmut
Astro 2020-04-14 00:08:57 +02:00
parent b26327e474
commit 60a29456ec
1 changed files with 2 additions and 1 deletions

View File

@ -82,10 +82,11 @@ impl TcpStream {
/// handshaking. Spawns additional tasks for each connection.
pub fn listen<F, R, T>(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<Output = T> + 'static,
{
for _ in 0..backlog {
let f = f.clone();
task::spawn(async move {
loop {
// Wait for new connection