-
Notifications
You must be signed in to change notification settings - Fork 30
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
Proposal: Move sync
and async
features into seperate modules
#37
Comments
sync
and async
features into seperate modulessync
and async
features into seperate modules
Hey @Weasy666 Thank you for your post !! If we do move |
I'm don't know, but i would guess that it's not necessary. Because you still could rename a imported modul with |
Well, I once tried this approach and find myself always comparing the sync and async version to keep these two implementation the same. Whenever a improvement is made on async version, I have to apply the some modification to sync, and I suddenly find the changes can be improved better. So I am reluctant to move back to this approach. I want to write code once and get both async and sync for free. I have think of an improvement on There is a really bad workaround, that is to use different versions of arangors with different feature gate to keep one async while convert another version to blocking. Say we can add a 0.3 arangors and set the BTW, even if we really keep two version of arangors, one sync and the other async, testing is not a issue since we can use a macro to simply copy the unit test and make it blocking. |
@fMeow I'd like to clarify that the crux of the issue is that your crate is currently misusing Cargo features. Cargo features must be additive; any other use of features is incorrect and can break code. In particular, this means that your crate must be able to build with both features enabled and cannot require any exclusivity between features. Code like the following violates this: arangors/src/connection/mod.rs Lines 81 to 85 in cfa2ae9
One way to accomplish this for cases like yours is to namespace the variants. as proposed by @Weasy666. This way, both features can be enabled without breakage. |
The underlying problem is much more complicated than an alias of |
If default = [ "rocksdb"]
blocking = [ "maybe-async/is_sync", "reqwest/blocking"]
cluster = [ ]
enterprise = [ ]
mmfiles = [ ]
rocksdb = [ ]
arango3_7 = [ ]
The features would be additive even though both async and sync code won't be available at the same time |
This violation of addtive rules of rust feature gate is a pain in arangors for a long time. But now I think addtive rules is no long a obligation with the new resolver in cargo introduced in Rust 1.51. But for crates that depends on |
As came up in the discussion on this rwf2/Rocket#1433, do you think it is feasible to move the
sync
andasync
features into seperate modules, likereqwest
is doing? So that both can be used simultaneously within one workspace. Otherwise it would not be possible to integrate both, as an option the rocket user can choose from, inrocket_contrib
.The current behavior of the two features would force
rocket_contrib
to decide which of both to integrate and block the other feature from ever be used with it.The text was updated successfully, but these errors were encountered: