rust-tokio

    3热度

    1回答

    我使用Tokio框架在Rust中创建重复任务。以下代码基于completed change request将此功能添加到tokio-timer包。 当尝试编译,我得到错误信息: error[E0281]: type mismatch: the type `fn() {my_cron_func}` implements the trait `std::ops::FnMut<()>`, but the

    2热度

    1回答

    我认为.for_each()会做的伎俩,但它只返回渠道的第一个(未来)项目,然后返回,如果通道是空的。在非Tokio /未来上下文中,无限期地读取任务中的频道的方式是.for_each()? let tx_origs_reader = rx_chan.for_each(move |tx_orig| { //save receiver side tx to db let mut