deepgram-rust-sdk
deepgram-rust-sdk copied to clipboard
Proposal: make tokio optional
It should be possible to use the library without picking a runtime.
The live feature would take some work to uncouple from tokio and tungstenite, so I left it under a default flag for now.
Thanks for the PR!
In principle, I'm okay with the idea of being able to use any runtime. However, our dependency on tokio runs a little deeper than the explicit dependency. reqwest only works with tokio, and we use reqwest to make the HTTP request.
Are you using async-std?
@andrewhalle Im using smol and it's possible to use reqwest with a different runtime using the async-compat crate: https://github.com/smol-rs/async-compat
@cardoso Ah okay, I understand now, thanks! Just to confirm, you're compiling for a WASM target? Otherwise, reqwest is still pulling in the tokio dependency.
I see that async-compat has a tokio dependency as well, so even if we make tokio optional in this crate, you'll still be getting it from that, right?
@andrewhalle yes, but not the runtime, so it's good enough for now to make the SDK usable with other runtimes and in wasm targets.
It would be good to make reqwest optional as well in the future, so an async runtime wouldn't be needed to access the pre-recorded API, but I wanted to make this PR short.
Cool, sounds good then. I'll give this a review, and we'll get this in. Thanks!
@cardoso Just checking back in on this, is this still something you're interested in merging?