Currently, dioxus-desktop imports rfd with default features, which, by default enables async-std. If I import rfd with the tokio feature, it causes a compile error:
[dependencies]
dioxus = { version = "0.5.1", features = ["desktop"] }
rfd = { version = "0.14.0", default-features = false, features = ["xdg-portal", "tokio"]}
error[E0252]: the name `AsyncReadExt` is defined multiple times
--> /home/soph/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.8.1/src/desktop/secret.rs:28:13
|
26 | use futures_util::AsyncReadExt;
| -------------------------- previous import of the trait `AsyncReadExt` here
27 | #[cfg(feature = "tokio")]
28 | use tokio::{io::AsyncReadExt, net::UnixStream};
| ^^^^^^^^^^^^^^^^ `AsyncReadExt` reimported here
|
= note: `AsyncReadExt` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
28 | use tokio::{io::AsyncReadExt as OtherAsyncReadExt, net::UnixStream};
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0252]: the name `UnixStream` is defined multiple times
--> /home/soph/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.8.1/src/desktop/secret.rs:28:31
|
24 | use async_net::unix::UnixStream;
| --------------------------- previous import of the type `UnixStream` here
...
28 | use tokio::{io::AsyncReadExt, net::UnixStream};
| ^^^^^^^^^^^^^^^ `UnixStream` reimported here
|
= note: `UnixStream` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
28 | use tokio::{io::AsyncReadExt, net::UnixStream as OtherUnixStream};
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0252]: the name `File` is defined multiple times
--> /home/soph/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.8.1/src/helpers.rs:6:13
|
2 | use async_fs::File;
| -------------- previous import of the type `File` here
...
6 | use tokio::{fs::File, io::AsyncReadExt};
| ^^^^^^^^ `File` reimported here
|
= note: `File` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
6 | use tokio::{fs::File as OtherFile, io::AsyncReadExt};
| ~~~~~~~~~~~~~~~~~~~~~
error[E0252]: the name `AsyncReadExt` is defined multiple times
--> /home/soph/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.8.1/src/helpers.rs:6:23
|
4 | use futures_util::AsyncReadExt;
| -------------------------- previous import of the trait `AsyncReadExt` here
5 | #[cfg(feature = "tokio")]
6 | use tokio::{fs::File, io::AsyncReadExt};
| ^^^^^^^^^^^^^^^^ `AsyncReadExt` reimported here
|
= note: `AsyncReadExt` must be defined only once in the type namespace of this module
help: you can use `as` to change the binding name of the import
|
6 | use tokio::{fs::File, io::AsyncReadExt as OtherAsyncReadExt};
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: You can't enable both async-std & tokio features at once
--> /home/soph/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ashpd-0.8.1/src/lib.rs:10:1
|
10 | compile_error!("You can't enable both async-std & tokio features at once");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0252`.
error: could not compile `ashpd` (lib) due to 5 previous errors
The compile error goes away if I remove the desktop feature, confirming that dioxus-desktop is to blame.
AFAIK dioxus doesn't use async-std anywhere (although it does use tokio), so the feature flag should be safe to remove.
Perhaps allow users to specify if they want to use rfd with async-std or tokio with a feature flag, like
[dependencies]
dioxus = { version = "0.5.1", features = ["desktop", "desktop-rfd-async-std"] }
or
[dependencies]
dioxus = { version = "0.5.1", features = ["desktop", "desktop-rfd-tokio"] }
For now the workaround seems to be to import an earlier version of rfd, so that cargo considers them different crates.
Currently,
dioxus-desktop
importsrfd
with default features, which, by default enablesasync-std
. If I import rfd with thetokio
feature, it causes a compile error:The compile error goes away if I remove the
desktop
feature, confirming thatdioxus-desktop
is to blame.AFAIK dioxus doesn't use
async-std
anywhere (although it does use tokio), so the feature flag should be safe to remove.Perhaps allow users to specify if they want to use rfd with async-std or tokio with a feature flag, like
or
For now the workaround seems to be to import an earlier version of
rfd
, so that cargo considers them different crates.