#3355

Replace `smol` with `async-channel` where only channels are used

OpenMnwaopened 28d ago

In gpui-kit 0.7.0, both gpui-base and gpui-component have a non-optional dependency on smol for native targets.

Looking through their sources, I found only two usages:

  • crates/base/src/async_util.rs: re-exports smol::channel::{Receiver, Sender, unbounded}.
  • crates/component/src/theme/registry.rs: uses smol::channel::bounded(100) in _watch_themes_dir.

Since smol::channel is a re-export of async-channel, could these crates depend on async-channel directly instead?

The proposed change would be:

  • Use async_channel::{Receiver, Sender, unbounded} on all targets in gpui-base. The WASM implementation already uses this.
  • Replace smol::channel::bounded(100) with async_channel::bounded(100) in gpui-component.
  • Remove the corresponding smol dependencies and declare async-channel directly.

This should preserve the channel types and behavior while avoiding unnecessary dependencies on the rest of smol, such as async-fs and async-net, for consumers that only need the UI components. GPUI already brings async-channel into our dependency graph.

Is there another use of smol, or a compatibility reason to retain it, that I have missed?

Activity

0

No activity yet.