Don't bake in Send + 'static.

Send + 'static was baked in to make it possible to spawn futures onto
the default executor. We can accomplish the same thing by offering
helper fns that do the spawning while not requiring it for the rest of
the functionality.

Fixes https://github.com/google/tarpc/issues/212
This commit is contained in:
Tim Kuehn
2019-07-22 13:13:08 -07:00
committed by Tim
parent 13cb14a119
commit 50879d2acb
15 changed files with 428 additions and 210 deletions

View File

@@ -75,11 +75,11 @@ async fn main() -> io::Result<()> {
// the generated World trait.
.map(|channel| {
let server = HelloServer(channel.as_ref().as_ref().peer_addr().unwrap());
channel.respond_with(server.serve())
channel.respond_with(server.serve()).execute()
})
// Max 10 channels.
.buffer_unordered(10)
.for_each(|_| futures::future::ready(()))
.for_each(|_| async {})
.await;
Ok(())