if-watch icon indicating copy to clipboard operation
if-watch copied to clipboard

feature request: expose tokio vs async-global-executor feature flags

Open dignifiedquire opened this issue 2 years ago • 8 comments

Looking at rtnetlink it already exposes both the async-global-executor and tokio executors as features, so I think it should be mostly a matter of threading it through.

dignifiedquire avatar Jul 07 '22 22:07 dignifiedquire

I would welcome this change. @dignifiedquire do you want to propose a patch?

mxinden avatar Jul 11 '22 02:07 mxinden

Currently, the linux implementation also hardcodes the use of smol. Would you see changing that in scope @mxinden ?

Disclaimer: I am pretty unfamiliar with this crate and only had a brief look.

thomaseizinger avatar Jul 11 '22 08:07 thomaseizinger

@mxinden I can take a look next week probably, if nobody claims it before.

@thomaseizinger I would try to avoid smol in this setup and use tokio/async-std directly depending on the current feature.

dignifiedquire avatar Jul 11 '22 14:07 dignifiedquire

I am failing to do this, because this needs to enable features depending on the target, and cargo has not implemented this yet :/ If anyone has ideas, I am all ears.

dignifiedquire avatar Jul 21 '22 13:07 dignifiedquire

Is this becausertnetlink is only a dependency on Linux and therefore, the feature flag can't target it on other platforms?

thomaseizinger avatar Jul 21 '22 21:07 thomaseizinger

yes, exactly

dignifiedquire avatar Jul 21 '22 23:07 dignifiedquire

I wonder if the crate renaming works on the level already?

If yes, we could try and make an empty crate with just two features that we can add for those targets and rename it to rtnetlink.

Alternatively, we could make a proxy crate that re-exports everything from rtnetlink that compiles on all platforms but doesn't have any code for MacOS and Windows.

The former would be nice because it is a one-time effort whereas for the latter, we would have to always release a new version, every time they release one.

A third idea would be to ask the maintainers of rtnetlink to cfg(target) their entire crate under linux.

thomaseizinger avatar Jul 22 '22 06:07 thomaseizinger

I just noticed that with tokio-only rust-libp2p addition of libp2p-tcp pulls in this dependency, which adds async-io and a whole bunch of related files to lock file even though tokio feature is used. I see async-io is still used as a fallback on some platforms, are there platforms of interest that are supported by it, but not by tokio?

UPD: It pulls the whole smol.

nazar-pc avatar Sep 14 '24 19:09 nazar-pc