Open theduke opened 5 years ago
I'm running into a similar problem with a project of mine, where I'd like to reuse an existing actor across multiple consumers (e.g., rust-irc and hyper). Currently on the 0.13 branch, I start my irc clients first using a reactor from IrcReactor::new()
and use that reactor's inner_handle()
to then .spawn()
my webserver on it.
Ideally, I'd like to retain the mechanism that creates a new reactor from within irc or consume a custom reactor when registering a client with a handler.
If you think this is useful to others, I'd try writing a pull request, but I think I'll need a bit of handholding. I don't know where to start :)
Hi @freddyb, I believe the 0.14 update has already circumvented the need for that as it's more in line with the more modern approach in the newer versions of tokio. In particular, we no longer have an IRC reactor at all (instead using async/await and the default tokio executor most of the time).
The
0.14
branch only allows creating a client with the global default reactor.While this is fine for most use cases and is a nicer API, it should always be optionally possible to still specify the Reactor manually by passing in a
Handle
.This came up quite a bit in the tokio refactor RFCs, I can dig out the issue if required.
But there should definitely be an additional method that still allows specifying the handle if you don't want to use the global default.