bisync
Easily write synchronous and asynchronous code at the same time.
This crate is inspired by maybe-async, but uses a different approach and tries to be more minimalistic.
How do I use it?
Annotate the functions you'd like to have generic w.r.t. asynchronisity with #[bisync].
You can specialize functions by annotating them with #[only_sync] or #[only_async].
You need a tiny bit of boilerplate in the parent module but that's all there is to it.
Example
// lib.rs
// here you could also add `#[cfg]` attributes to enable or disable this module
// inner.rs
// these are all the available definitions:
use ;
pub async
async
async
The example above will strip away all async and await from the functions in the blocking module, but will leave them in the asynchronous module.
Hence, you can easily use the functions either in a synchronous or an asynchronous context.