Expand description
Zero-copy I/O utilities.
This module provides utilities for minimizing buffer copies during I/O operations, improving performance for high-throughput terminal automation.
§Features
BytesBuffer: Reference-counted bytes for zero-copy slicingVecWriter: Efficient vectored write batchingBorrowedView: Borrowed slice views with lifetime tracking
§Example
use rust_expect::util::zerocopy::{BytesBuffer, VecWriter};
// Create a buffer with zero-copy slicing
let mut buffer = BytesBuffer::new();
buffer.extend(b"hello world");
// Slice without copying
let slice = buffer.slice(0..5);
assert_eq!(&slice[..], b"hello");
// Batch multiple writes
let mut writer = VecWriter::new();
writer.push(&b"hello"[..]);
writer.push(&b" "[..]);
writer.push(&b"world"[..]);
let bytes = writer.freeze();
assert_eq!(&bytes[..], b"hello world");Structs§
- Bytes
Buffer - A reference-counted byte buffer that supports zero-copy slicing.
- Read
Pool - A read buffer that minimizes copies during async reads.
- VecWriter
- A writer that batches multiple small writes for vectored I/O.
Enums§
- Borrowed
View - A borrowed view of bytes with lifetime tracking.
Traits§
- Zero
Copy Source - Trait for types that can provide a zero-copy view of their contents.