-
I am a library developer and am looking to support both sync and async. I thought it would be easy to create a sync version by creating an async API and But, if I call sync incorrectly in async runtime, I get an error with duplicate runtime startup. Is there a way to make the compiler make an error in incorrect usage or is there a better way to implement this? Or block_on just to make an async implementation sync. 📝 Ideas for making sync and async implementations common include quansync in typescript. I am looking into whether a similar approach exists for Rust. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
If you build a sync API by internally calling |
Beta Was this translation helpful? Give feedback.
Unfortunately, Rust does not have any mechanism to prevent such mistakes at compile time.