This crate can be used to easily write code for synchronous as well as asynchronous clients.
The use should be straight-forward. You can put this into your file where you'd like to have both synchronous and asynchronous submodules:
// lib.rs
// here you could also add `#[cfg]` attributes to enable or disable this module
(The reason why I recommend to copy-paste this instead of providing a macro that does it for you is because LSPs struggle with modules defined within macros)
Then, within your inner module, you can write code that is async-generic:
// inner.rs
// these are all the available definitions:
use ;
pub async
async
async
Here, depending on if we are within async or sync code, we use a different library to perform the requests.
As you can see, we prevent duplicate definitions of foo and bar because they get generated twice,
once in synchronous form, and once in asynchronous form.