书栈网 · BookStack 本次搜索耗时 0.026 秒,为您找到 349 个相关结果.
  • Spawning

    435 2021-05-16 《Tokio v1.6 Tutorial》
    Spawning Accepting sockets Concurrency Tasks 'static bound Send bound Store values Spawning We are going to shift gears and start working on the Redis server. First, m...
  • 示例:Echo服务器

    示例:Echo服务器 创建 处理连接 示例:Echo服务器 我们将使用到目前为止所覆盖的内容来构建echo服务器。这是一个Tokio应用程序,它包含了我们迄今为止学到的所有内容。服务器将简单地从连接的客户端接收消息,并将收到的相同消息发送回客户端。 我们将能够使用我们在hello world 部分中创建的基本Tcp客户端来测试此echo服务器 ...
  • Loops

    548 2020-12-25 《Tokio v1.0 Tutorial》
    Loops Resuming an async operation Modifying a branch Loops The select! macro is often used in loops. This section will go over some examples to show common ways of using the...
  • I/O概叙

    I/O概叙 一个服务器例子 I/O概叙 Rust标准库提供对网络和I/O的支持,例如TCP连接,UDP套接字,读取和写入文件等。但是,这些操作都是同步或阻塞的,这意味着当它们被调用时,当前线程可能会停止执行并进入睡眠状态,直到它被解除阻塞。例如,std::Read 中的read 方法会阻塞当前线程,直到能读取到数据。在使用Future的时候,这种行...
  • Errors

    444 2020-12-25 《Tokio v1.0 Tutorial》
    Errors Errors Using the ? operator propagates the error from the expression. How this works depends on whether ? is used from an async expression or from a handler. Using ? ...
  • Hello World

    Hello World 创建流 写入数据 运行客户端任务 运行代码 下一步 Hello World 为了开始我们的Tokio之旅,我们先从我们必修的"hello world"示例开始。 这个程序将会创建一个TCP流并且写入"hello,world"到其中.这与写入非Tokio TCP流的Rust程序之间的区别在于该程序在创建流或者将"hel...
  • Helper functions

    304 2020-12-25 《Tokio v1.0 Tutorial》
    Helper functions Helper functions Additionally, just like std , the tokio::io module contains a number of helpful utility functions as well as APIs for working with standard ...
  • Timers

    Timers 一段时间后运行代码 计时耗时操作 在间隔时间段上运行代码 计时器的注意事项 Timers 在编写基于网络的应用程序时,通常需要根据时间执行操作。 在一段时间后运行一些代码。 取消运行时间过长的运行操作。 以一定间隔重复执行操作。这些用例通过使用计时器模块中提供的各种计时器API来处理。 一段时间后运行代码 在这种情况下...
  • Holding a MutexGuard across an .await

    1204 2020-12-25 《Tokio v1.0 Tutorial》
    Holding a MutexGuard across an .await Restructure your code to not hold the lock across an .await Spawn a task to manage the state and use message passing to operate on it Use...
  • Per-task concurrency

    367 2020-12-25 《Tokio v1.0 Tutorial》
    Per-task concurrency Per-task concurrency Both tokio::spawn and select! enable running concurrent asynchronous operations. However, the strategy used to run concurrent operat...