Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
如何使用 Tokio 同时运行一组函数,而无需同时运行相同的函数?
我的目标是同时运行 AND 函数 但在所有函数完成之前不想生成更多函数 这是 extern crate tokio extern crate futures use futures future lazy use std thread ti
Rust
rusttokio
从 Tokio 应用程序使用 Actix:混合 actix_web::main 和 tokio::main?
目前我主要写的是异步示例Reqwest library https crates io crates reqwest tokio main async fn main gt Result lt Box
Asynchronous
Rust
rusttokio
actixweb
从 futures::Stream 转发到 futures::Sink
我目前正在尝试了解 tokio futures 原语和生态系统 我开始做一些工作tk http websocket 示例 https github com swindon rs tk http blob abfdb50a00ab90b4f0
Rust
rusttokio
为什么 tokio::spawn 即使使用 .clone() 也会抱怨生命周期?
我试图编译以下看似简单的代码 但出现错误 use std io Error derive Debug struct NetworkConfig bind String node key file String async fn networ
Rust
asyncawait
lifetime
rusttokio
在生成的 tokio 任务中使用 dyn 异步特征(带有 async-trait crate)
我正在开发一个异步 Rust 应用程序 它利用tokio https crates io crates tokio 我还想将一些特征方法定义为async并选择了异步特征箱 https crates io crates async trait
Asynchronous
Rust
rusttokio
我可以克隆未来吗?
我想为未来编写一些通用的重试逻辑 我知道具体的返回类型 并且想在未来重试相同的操作 我的代码只能访问未来 我不想将每个 fn 调用站点包装在闭包中以启用重新创建它 似乎 未来 是 fn args 的组合 并且当 await被调用后 它会运行
Rust
rusttokio
futures::executor::block_on 和 block_in_place 之间是否存在性能差异
我在同步方法内调用异步代码 此方法是特征的一部分 我无法异步实现它 所以我使用block on等待异步调用完成 将从异步代码调用同步方法 所以应用程序是在 tokio main 当某些事件发生 端点命中 时 它会调用同步方法 同步方法将调用
Rust
rusttokio
为什么在将 Tokio 与 std::sync::Mutex 一起使用时会出现死锁?
我在使用 Tokio 时偶然发现了一个死锁情况 use tokio time delay for Duration use std sync Mutex tokio main async fn main let mtx Mutex new
Asynchronous
Rust
mutex
rusttokio
使用 hyper 将块流异步写入文件
我正在尝试创建一个简单的函数 使用 hyper 将远程文件下载到本地文件路径 我也需要异步写入文件 在我的例子中我使用tokio fs为了那个原因 这是代码 Parts of the code were omitted see the pl
Rust
Future
borrowchecker
rusttokio
Hyper
如何解释 read_until 的签名以及 Tokio 中的 AsyncRead + BufRead 是什么?
我试图理解 Rust 中的异步 I O 以下代码基于 Katharina Fey 的片段这对我有用 use futures future Future use std io BufReader use tokio io fn main le
Rust
rusttokio
如何使用 Tokio 远程关闭正在运行的任务
我有一个正在接收数据的 UDP 套接字 pub async fn start gt Result lt std io Error gt loop let mut data vec 0 1024 socket recv from mut da
Rust
rusttokio
如何将任务添加到在另一个线程上运行的 Tokio 事件循环?
我想 https stackoverflow com questions 54279989 is there a way to launch a tokiodelay on a new thread to allow the main lo
Rust
Future
rusttokio
将可变 Arc 引用传递给 hyper service_fn 处理程序时出现问题
我一直在尝试以下 显示相关导入和代码 use std sync Arc Mutex use std thread use hyper rt self Future Stream use hyper service service fn us
Rust
Future
smartpointers
rusttokio
Hyper
`std::result::Result
` 没有实现 `std::future::Future` 特性
我正在尝试运行基本的reqwest example extern crate reqwest extern crate tokio tokio main async fn main gt Result lt reqwest Error gt
Rust
asyncawait
rusttokio
reqwest
如何处理 tokio::spawn 闭包需要“static”和“&self”?
我无法理解如何编写封装在一个结构中的并发异步代码 我不确定如何准确解释这个问题 所以我会尝试用一个例子来解释 假设我有一个UdpServer结构 该结构有多个与其行为相关的方法 例如 handle datagram deserialize
Rust
rusttokio
如何从产生数据块的慢速处理侧线程流式传输超级请求的正文?
我有一个程序可以缓慢地生成数据 我们可以说它是计算密集型的 就像计算 pi 的数字一样 它产生一个lot数据的 每个响应可以是 1GiB 无法容纳在内存中 并且must按需生成 我正在使用 hyper 编写一个 Web 服务来根据请求生成内
Rust
rusttokio
Hyper
block_in_place和spawn_blocking如何选择?
我与 tokio 合作很多 并且一直在使用产卵阻塞用于阻止线程的代码 然后我看到了文档就地块看起来它是前者的无限制 发送 静态 版本 我的问题是 如果我已经在线程运行时 什么时候不建议使用 block in place 每种驱动同步码的方法
Rust
rusttokio
Rust 中如何在 future 和 Stream 之间进行选择?
我刚刚开始在 Rust 中尝试 futures tokio 我可以仅使用 future 或仅使用流来完成非常基本的事情 我想知道你如何在未来和流之间进行选择 如何将 tokio 文档中的玩具问题扩展到使用tokio timer Timer进
Stream
Rust
Future
rusttokio
理解错误:特征“futures::future::Future”没有为“()”实现
这个问题是关于如何阅读 Rust 文档并提高我对 Rust 的理解 从而了解如何解决这个特定的编译器错误 我读过东京文档并尝试了许多examples 在编写自己的代码时 我经常遇到我不理解的编译器错误 并且经常发现我可以修复代码 但不理解w
Rust
rusttokio
从函数返回未来值
我最近开始学习 Rust 我不确定如何从应该返回 Result 的函数返回未来值 当我尝试仅返回响应变量并删除结果输出时 出现错误 不能使用 返回的函数中的运算符std string String tokio main async fn d
Rust
rusttokio
1
2
»