Conversation
…ernal core to be passed in
|
Thanks for contributing! Unfortunately, I'm here to tell you there were the following style issues with your Pull Request:
Guidelines are available at https://github.com/hyperium/hyper/blob/master/CONTRIBUTING.md This message was auto-generated by https://gitcop.com |
|
Thanks for contributing! Unfortunately, I'm here to tell you there were the following style issues with your Pull Request:
Guidelines are available at https://github.com/hyperium/hyper/blob/master/CONTRIBUTING.md This message was auto-generated by https://gitcop.com |
|
Hi @seanmonstar :) Yes looks like #1075 is the sort of thing I'm trying to address. I'm trying to avoid any form of multithreading in my application, so would much prefer to have only a single Tokio core running. The idea of the Rc is that different pieces of code (with their own responsibilities) hold a reference to the core, and then the RefCell enables them to at any point borrow the core, get a handle and spawn some future on it. I'm very much bending this API to my own selfish goal though, so I totally understand if this is not the right way for the project. Also, maybe some re-architecting could yield a more elegant solution. If there were some copyable interface to the event loop I could pass around that would be much better, but I don't know how that would work, maybe that's even something Tokio itself should think about? |
|
You may be wanting a let server = Http::new().bind(addr, new_service)?;
let handle =server.handle(); |
|
Making use of a |
Make Server core a RefCell and introduce bind2 method that allows external core to be passed in
This is just an inspiration pull request. Do you see any problems with having core be a RefCell? I think it would be an insignificant overhead for posting new event handlers, but maybe I'm wrong and there's some tight loop that needs to dereference core?