Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/qrichert/tokio-sync2async

Helpers to bridge between sync and async code.
https://github.com/qrichert/tokio-sync2async

async rust rust-library tokio

Last synced: about 1 month ago
JSON representation

Helpers to bridge between sync and async code.

Awesome Lists containing this project

README

        

# tokio-sync2async

[![license: MIT](https://img.shields.io/badge/license-MIT-blue)](https://opensource.org/license/mit)
![GitHub Tag](https://img.shields.io/github/v/tag/qrichert/tokio-sync2async?sort=semver&filter=*.*.*&label=release)
[![crates.io](https://img.shields.io/crates/d/tokio-sync2async?logo=rust&logoColor=white&color=orange)](https://crates.io/crates/tokio-sync2async)
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/qrichert/tokio-sync2async/run-tests.yml?label=tests)](https://github.com/qrichert/tokio-sync2async/actions)

_Helpers to bridge between sync and async code._

```rust
use tokio_sync2async::sync_await;

#[tokio::main]
async fn main() {
sync_fn();
}

fn sync_fn() {
let res = sync_await(async_fn());
assert_eq!(res, 42);
}

async fn async_fn() -> i32 {
42
}
```