cannot find function `spawn` in crate `livekit_runtime`
Thintin914 opened this issue · 4 comments
Hello, first of all, thank you for the amazing work of LiveKit Rust support. I struggled to find a good rust realtime server-client sdk for weeks. I switched from AWS Gamelift to LiveKit to try something new.
I added livekit = "0.3.2"
to my Cargo.toml. I think it cannot get tokio in livekit_runtime.
Is there a temporary fork to resolve this issue? The same issue also happened in #380.
error[E0425]: cannot find function `spawn` in crate `livekit_runtime`
--> /Users/wulongting/.cargo/registry/src/index.crates.io-6f17d22bba15001f/livekit-protocol-0.3.4/src/debouncer.rs:38:22
|
38 | livekit_runtime::spawn(debounce_task(duration, future, rx, cancel_rx));
| ^^^^^ not found in `livekit_runtime`
|
help: consider importing one of these items
|
15 + use std::thread::spawn;
|
15 + use tokio::spawn;
|
help: if you import `spawn`, refer to it directly
|
38 - livekit_runtime::spawn(debounce_task(duration, future, rx, cancel_rx));
38 + spawn(debounce_task(duration, future, rx, cancel_rx));
|
error[E0425]: cannot find function `sleep` in crate `livekit_runtime`
--> /Users/wulongting/.cargo/registry/src/index.crates.io-6f17d22bba15001f/livekit-protocol-0.3.4/src/debouncer.rs:54:34
|
54 | _ = livekit_runtime::sleep(duration) => {
| ^^^^^ not found in `livekit_runtime`
|
help: consider importing one of these items
|
15 + use std::thread::sleep;
|
15 + use tokio::time::sleep;
|
help: if you import `sleep`, refer to it directly
|
54 - _ = livekit_runtime::sleep(duration) => {
54 + _ = sleep(duration) => {
|
Compiling tungstenite v0.20.1
Compiling epaint v0.28.1
Compiling core-video-sys v0.1.4
Compiling tokio-tungstenite v0.20.1
For more information about this error, try `rustc --explain E0425`.
error: could not compile `livekit-protocol` (lib) due to 2 previous errors
livekit_runtime
should use tokio if it's specified as a dependency in your Cargo.toml and livekit
has its default features set. if you're using livekit-api
directly, you need to add the signal-client-tokio
feature to it. could you send your Cargo.toml?
I only list some crates that is related:
[dependencies]
tokio = { version = "1", features = ["full"]}
livekit = "0.3.2"
livekit-api = "0.3.2"
My Cargo.toml also has tokio because I need to use it elsewhere. I don't know if that might cause error.
please update livekit and livekit-api to the newest versions published on crates.io just now, they should fix the issue
Thank you for fixing the issue. I updated the crate version and it's fine now.
[dependencies]
livekit = "0.5.1"
livekit-api = "0.4.0"