-
Notifications
You must be signed in to change notification settings - Fork 9
Implement Environment
for real tokio runtime
#11
Comments
Thanks for noting your approach! Did you happen to see tokio-rs/tokio#1845? |
I did not, thanks for pointing it out! |
I talked to @gardnervickers over email, but maybe this whole thing is at the wrong level? Should instead the simulation bits be pushed down into |
Sorry for the delay: oncall and life are what they are. I think there's a reasonable case to be for pushing the simulation bits into
I'd personally love to see Few additional notes:
|
I'm not sure it makes sense for the initial phase of simulation to deal with std. I'd ideally like to see us get interop that works well with tokio's types first. As for the implementation with the runtime, I'd like to see the choice of the user to choose a simulated type to be explicit but allow the runtime to hook into them. |
Meaning that users would need to pick either |
Right, internally, I'd like to see each type use an enum and on creation use a TLS value to check if it should initialize the simulated version or defer to the real one. I think once we standardize things we can move that enumed say TcpStream into tokio, but I'd like to keep the impact of this as minimal as possible for now. We should be able to add hyper connectors etc in a separate crate to easy the use of it. |
My understanding is that tokio-rs/tokio#1845 does entail the movement of types such as the the sealed/enumerated TcpStream into Tokio. Is that not correct? |
Right, I think we should start though with them living in this crate instead of in tokio. Looks like we need to do a rewrite in this crate anyways right now. |
Its much easier to move fastre in here than it would be in tokio's main repo. |
Closing as dup of #1845, lets move discussion into there. |
I want to make my functions generic over an
Environment
. I can do that over the runtimes in this crate but when I pass in the real tokio runtime I cannot due to orphan rules. If I wrap and implement, I get thatEnvironment
requiresClone
andtokio::runtime::Runtime
does not implement it.I ended up doing this (not sure if I need
Mutex
or not, I guess not becauseRuntime
isSend
andSync
):The text was updated successfully, but these errors were encountered: