Generate a blocking method for each async method in an impl block. Supports either tokio
or async-std
backend.
Generated methods are suffixed with _blocking
.
### Example tokio
```rust
use blockon::blockon;
struct Tokio {}
#[blockon("tokio")]
impl Tokio {
async fn testasync(&self) {}
}
```
Generates the following impl block ```rust async fn test_async(&self) {}
fn testasyncblocking(&self) { use tokio::runtime::Runtime; let mut rt = Runtime::new().unwrap(); rt.blockon(self.testasync()) } ```
### Example async-std
```rust
use blockon::blockon;
struct AsyncStd {}
#[blockon("async-std")]
impl AsyncStd {
async fn testasync(&self) {}
}
```
Generates the following method in the same impl block ```rust async fn test_async(&self) {}
fn testasyncblocking(&self) { use asyncstd::task; task::blockon(self.test_async()) } ```