Module tokio_test::io

source ·
Expand description

A mock type implementing AsyncRead and AsyncWrite.

§Overview

Provides a type that implements AsyncRead + AsyncWrite that can be configured to handle an arbitrary sequence of read and write operations. This is useful for writing unit tests for networking services as using an actual network type is fairly non deterministic.

§Usage

Attempting to write data that the mock isn’t expecting will result in a panic.

Structs§

  • Builds Mock instances.
  • A handle to send additional actions to the related Mock.
  • An I/O object that follows a predefined script.