Module net

Module net 

Source
Expand description

Network abstractions for dependency injection and testing.

This module provides traits and types that allow our networking components to work with both real networking (tokio::net) and simulated networking (turmoil::net) through dependency injection.

§Conditional Compilation

The module re-exports TCP types that are swapped at compile time:

  • Default builds: tokio::net::{TcpStream, TcpListener}
  • Builds with --features turmoil: turmoil::net::{TcpStream, TcpListener}

This allows production code to be tested with turmoil’s network simulation without runtime overhead or code changes when the feature flag is enabled.

Structs§

RealTcpConnector
Production TCP connector.
TcpListener
A simulated TCP socket server, listening for connections.
TcpStream
A simulated TCP stream between a local and a remote socket.

Traits§

TcpConnector
Trait for network types that can establish TCP connections.