Borrowed value does not live long enough with a Tokio future
问题 I'm trying to write a simple HTTP server using Rust and tokio. Everything works fine until I want to send the response. The code is the following: use std::fs; use std::sync::Arc; use tokio::net::TcpListener; // 0.1.15 use tokio::prelude::*; fn main() { let addr = "0.0.0.0:8080".parse().unwrap(); let listener = TcpListener::bind(&addr).expect("unable to bind TCP listener"); let incoming = listener.incoming(); let server = incoming .map_err(|e| eprintln!("accept failed = {:?}", e)) .for_each(