Repository navigation
Is there a way to use rust-anything with async code? #305
|
Can I call it from inside a Tokio runtime, or does it block the thread? If it blocks, is spawn_blocking the recommended workaround? |
Answered by
erkamyaman
Nov 23, 2026
Replies: 1 comment
|
You don't call it from your own Tokio code: rust-anything ports are called from the original language (JS, Python, etc.), through the generated bindings.
|
0 replies
Answer selected by
nezuko35
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't call it from your own Tokio code: rust-anything ports are called from the original language (JS, Python, etc.), through the generated bindings.
pub async fnand JS gets a Promise back. napi-rs runs it on its own async runtime, so it doesn't block Node's event loop.spawn_blockinginside it if you like), or move the whole loop with--batch.