-
Notifications
You must be signed in to change notification settings - Fork 124
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
Avoiding conflicting features; allow multiple HTTP clients at once #221
Comments
By the way, this is completely unrelated to #215. You can still merge these and I'll work on this afterwards. There's no rush to close this issue as long as it's done before the new version; I'll do so when I have a bit of time. |
I've made this repo to prove how this can be a problem, even with the new resolver: https://github.com/marioortizmanero/resolver-v2-conflict |
Would it be possible to publish two crates based on the same source code? One with the sync feature forcefully enabled and one with the async feature forcefully enabled? This is basically what rapier does to handle 2d/3d and f32/f64 with the same source. For example the 2d variant with f32 floats uses this |
I tried to do that in a million ways, including how rapier does it in your links, but I ultimately gave up. I couldn't find any examples either, which made it harder. It's pretty cool that rapier managed to do it. I might have been doing it the wrong way because I didn't even know about Anyhow, actually fixing the problem instead of using a hack like that will be better in the long run. No need for feature combinations when testing (just |
This is super interesting and might actually fix our issue! https://blog.rust-lang.org/inside-rust/2022/07/27/keyword-generics.html |
Message to comment on stale issues. If none provided, will not mark issues stale |
Something that has been troubling me for a while is that we have conflicting features in rspotify, but features in Rust must be additive:
client-ureq
andclient-reqwest
are enabled at the same time, they'll get hit by a compiler error warning them not to do so.reqwest
does for itsblocking
feature. It's not a toggle. Instead, it enables theblocking
module so that you may use it in combination of the async one.This is important because the Rust compiler may merge features of a crate when it's duplicated in the dependency tree. If your crate has a dependency somewhere on rspotify with reqwest and at the same time somewhere else rspotify with ureq, that will never possibly work because you can't merge
client-ureq
withclient-reqwest
. This is explained a few times in this post, for example here.I thought this was more complicated than it actually is (still not easy). We actually have a base HTTP trait already, so what if we make the Spotify client generic over it? Here's a playground link that explains it: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=de0e9c0a596a5004b3e4af41071415d6. It might simplify a lot of things, really! The only downside is that the syntax to initialize the client will be a bit ugiler to specify the HTTP client.
Related issues:
sync
andasync
features into seperate modules fMeow/arangors#37The text was updated successfully, but these errors were encountered: