-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The result of serve_nbd is never Send #11
Comments
Hm, I see your point. And I'm not really sure what a good solution is either. Using a feature flag and possibly duplicating code just for avoiding Maybe @joshtriplett has some input on the matter since he proposed to add the |
@oll3 Unfortunately, I have the opposite use case: my implementation of Rather than a feature flag, I think it would make sense to have two types, one that implements |
@joshtriplett I see. Then a separate trait which is @refi64 anything oppose this, would you mind creating a PR? 🙂 |
@oll3 FWIW, this issue (having to duplicate things for the Send and non-Send worlds) is one of many bits of friction that I think folks in the Async Foundations WG are trying to come up with solutions for. |
#4's first commit removed the
Send
requirement onBlockDevice
. This makes sense, because there's no real reason it needs to be send...but it also has a very unfortunate consequence:BlockDevice
can never beSend
.As a result,
serve_nbd
's returnedFuture
isn'tSend
, which heavily limits where it can be used. In particular, I was trying to do this:But, because
start_nbd
's result isn'tSend
, it's not possible without resorting to using aLocalSet
, which is...well, pretty ugly.Unfortunately, I'm not sure if there's a particularly "clean" way to solve this. I think if
send
is a crate-level feature, then you could do:i.e.
BlockDevice
is onlySend
if the corresponding feature is active. This does make it a workspace-wide control, but it's the only non-insane option I can think of. EDIT: well turns out you need to copy the entireBlockDevice
definition, with one behindcfg(feature = "send")
that'strait BlockDevice: Send
, didn't notice before because rust-analyzer wasn't communicating the errors to me 😅The text was updated successfully, but these errors were encountered: