forked from M-Labs/zynq-rs
libasync: change TcpStream::listen() callback constraint from Copy to Clone
This commit is contained in:
parent
b26327e474
commit
60a29456ec
@ -82,10 +82,11 @@ impl TcpStream {
|
|||||||
/// handshaking. Spawns additional tasks for each connection.
|
/// 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)
|
pub fn listen<F, R, T>(port: u16, rx_bufsize: usize, tx_bufsize: usize, backlog: usize, f: F)
|
||||||
where
|
where
|
||||||
F: Fn(Self) -> R + Copy + 'static,
|
F: Fn(Self) -> R + Clone + 'static,
|
||||||
R: Future<Output = T> + 'static,
|
R: Future<Output = T> + 'static,
|
||||||
{
|
{
|
||||||
for _ in 0..backlog {
|
for _ in 0..backlog {
|
||||||
|
let f = f.clone();
|
||||||
task::spawn(async move {
|
task::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
// Wait for new connection
|
// Wait for new connection
|
||||||
|
Loading…
Reference in New Issue
Block a user