async_std 1.8 对 `async_std::channel` 中的项目有未解决的导入

async_std 1.8 has unresolved imports for items in `async_std::channel`

我正在使用 async_std 构建应用程序,但这 returns 一个未解决的导入错误:

use async_std::sync::Sender;

查看 1.8.0 的文档后,async_std::sync 似乎已 deprecated in favor of async_std::channel. This was not the case in 1.7.0

更新到1.8.0后,我尝试将use async_std::sync::Sender;替换为use async_std::channel::Sender

文档似乎同意它应该工作,但我仍然遇到未解决的导入错误。

我错过了什么?

您需要启用 unstable 功能:

async-std = { version = "1.8.0" , features = ["unstable"] }

文档在 1.7 和 1.8 中告知您有关 async_std::sync 的信息:

不幸的是,在 1.8 中,async_std::channel 总是 存在,但是 only re-exports the contents when unstable is present:

//! Channels

#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
#[doc(inline)]
pub use async_channel::*;