oxigraph icon indicating copy to clipboard operation
oxigraph copied to clipboard

Use `futures::AsyncRead` instead of ``tokio::AsyncRead`

Open damooo opened this issue 4 months ago • 2 comments

Is your feature request related to a problem? Please describe.

Currently crate uses async io traits from tokio instead of from futures. tokio is not compatible with wasm. And tokio runtime too is multithreaded and doesn't work on wasm. Whereas traits and types from futures doesn't assume a runtime and have support from wasm_bindgen, and wasm_bindgen_futures.

tokio has compat util module, which provides simple adapters for io traits from futures. Thus tokio users won't have any issue.

Describe the solution you'd like

Use io crates from futures. The interface is mostly similar and migration should be straight forward. It will allow to add wasm support for ox* crates and it's dependents in future.

damooo avatar Sep 12 '25 08:09 damooo

Or we can support both futures io and tokio io, with different feature flags asyncio-futures, asyncio-tokio. This would be backward compatible and very little effort.

I could file a PR if agreed in principle.

Thank you.

damooo avatar Sep 12 '25 13:09 damooo

Or we can support both futures io and tokio io, with different feature flags asyncio-futures, asyncio-tokio. This would be backward compatible and very little effort.

I could file a PR if agreed in principle.

Yes! An other async-futures feature flag would be very welcome!

Tpt avatar Sep 12 '25 16:09 Tpt