Add smol implementation for spawn

Although this is used in apps that use `tokio`, if we're going to
support `smol`, this seems suboptimal to require.

This assumes the function will be called by a tokio executor if the
`tokio` feature is used. Otherwise it can be spawned from any executor.
That should be consistent with everything else.

This fails to compile without either the `tokio` or `smol` feature. This
seems reasonable, since `zbus` also fails to compile in that case.
This commit is contained in:
Ian Douglas Scott 2024-07-26 10:56:19 -07:00 committed by Ian Douglas Scott
parent 8c00bf3d8b
commit 732c7aef5c
2 changed files with 23 additions and 6 deletions

View file

@ -33,7 +33,6 @@ desktop = [
"dep:freedesktop-desktop-entry",
"dep:mime",
"dep:shlex",
"dep:tokio",
"dep:textdistance",
"dep:zbus",
]
@ -42,7 +41,7 @@ serde-keycode = ["iced_core/serde"]
# Prevents multiple separate process instances.
single-instance = ["dep:zbus", "ron"]
# smol async runtime
smol = ["iced/smol", "zbus?/async-io"]
smol = ["dep:smol", "iced/smol", "zbus?/async-io"]
tokio = [
"dep:tokio",
"ashpd?/tokio",
@ -92,13 +91,14 @@ rfd = { version = "0.14.0", optional = true }
rustix = { version = "0.38.34", features = ["pipe", "process"], optional = true }
serde = { version = "1.0.180", features = ["derive"] }
slotmap = "1.0.6"
smol = { version = "2.0.0", optional = true }
textdistance = { version = "1.0.2", optional = true }
thiserror = "1.0.44"
tokio = { version = "1.24.2", optional = true }
tracing = "0.1"
unicode-segmentation = "1.6"
url = "2.4.0"
zbus = { version = "4.2.1", default-features = false, features = ["tokio"], optional = true }
zbus = { version = "4.2.1", default-features = false, optional = true }
[target.'cfg(unix)'.dependencies]
freedesktop-icons = "0.2.5"