let addr = bind.parse().unwrap();
let server_gen = NewServer { singleton: Server::new(pool, store) };
let server = hyper::Server::bind(&addr)
.serve(server_gen)
.map_err(|e| error!("Server Error [500]: {}", e));
rt::run(server);
I have a Hyper service (Server) and a struct that implements NewService (NewServer), but when I try to compile this, I get the following error:
error[E0277]:
(dyn hyper::rt::Future<Error=hyper::Error, Item=hyper::Response<hyper::Body>> + 'static)cannot be sent between threads safely
--> src/main.rs:55:10 |
55 | .serve(server_gen)
| ^^^^^(dyn hyper::rt::Future<Error=hyper::Error, Item=hyper::Response<hyper::Body>> + 'static)cannot be sent between threads safely
|
= help: the traitstd::marker::Sendis not implemented for(dyn hyper::rt::Future<Error=hyper::Error, Item=hyper::Response<hyper::Body>> + 'static)
= note: required because of the requirements on the impl ofstd::marker::Sendforstd::ptr::Unique<(dyn hyper::rt::Future<Error=hyper::Error, Item=hyper::Response<hyper::Bo dy>> + 'static)>
= note: required because it appears within the typestd::boxed::Box<(dyn hyper::rt::Future<Error=hyper::Error, Item=hyper::Response<hyper::Body>> + 'static)>
Server implements Send, it looks like it is saying the actual boxed future doesn't implement Send?
