I'm adding async support to my existed sync APIs. Thanks to async/await syntax I don't have to rewrite everything but simply add
async keyword to some of my functions. This makes me thinking of using conditional compilation techniques to turn on async code by feature flag.
await code, I can feature-gate them under a
#[cfg(feature="async")] block. However, there seems to be no way to add
async keyword to
fn xxx() like this.
I wonder if any good practice for this?
There is a macro crate
maybe_async. But it's async first which not work for my sync first APIs.