async-compatibility-layer

Crates.ioasync-compatibility-layer
lib.rsasync-compatibility-layer
version1.2.1
sourcesrc
created_at2024-04-02 15:54:51.829861
updated_at2024-07-10 17:35:29.349812
descriptionan abstraction layer for using both async-std and tokio
homepage
repository
max_upload_size
id1193678
size76,495
Jeb Bearer (jbearer)

documentation

README

What is this?

This crate exports four things:

  • A compatibility/abstraction layer for writing async-executor agnostic code. We support two async executors: async-std and tokio. Each may be toggled with a configuration flag.
  • A compatibility/abstraction layer for writing async channel agnostic code. We support three async channel implementations: async-std, tokio and flume. Each may be toggled with a configuration flag.
  • A library exporting a bunch of useful async primitives.
  • A tracing configuration layer optionally supporting console and opentelemetry integration.

Example usage

By default the async-std executor and channels are used.

To use tokio:

RUSTFLAGS='--cfg async_executor_impl="tokio" --cfg async_channel_impl="tokio"' cargo build

async_executor_impl may be either tokio or async-std. async_channel_impl may be either tokio, async-std, or flume.

Note that using tokio channels requires tokio to be the runtime.

Commit count: 0

cargo fmt