mockpipe-0.1.2 has been yanked.
MockPipe
An in-memory, thread-safe, bidirectional pipe for Rust applications. It provides functionality for reading and writing data with optional timeout support. MockPipe utilizes an internal in-memory circular buffer without relying on operating system resources and implements Rust's standard Read and Write traits. This makes it a useful tool for testing applications that use communication mechanisms like sockets, pipes, or serial ports.
Example
use ;
use MockPipe;
More examples can be found in the examples folder in the root of this repository.
Features
- Loopback mode: Create a pipe that writes data into a buffer and allows reading the same data back from the same buffer, simulating a loopback interface.
- Paired pipes: Create two pipe instances that can exchange data in a full-duplex manner, simulating a communication channel between two endpoints.
- Timeout support: Specify a timeout for reading and writing operations to test different behaviors in blocking and non-blocking scenarios.
- No OS resource usage & No unsafe code: Operates without relying on operating system resources and is implemented entirely with safe Rust, without any
unsafeblocks. - In-memory operation: Does not consume OS-level resources, ideal for unit testing.
- Standard IO trait support: Implements
std::io::Readandstd::io::Writetraits for seamless integration with Rust's I/O ecosystem.
License
Licensed under either of Apache License, Version 2.0 (LICENSE-APACHE) or MIT license (LICENSE-MIT) at your option.