Expand description
§VCL Connection Pool
VCLPool manages multiple VCLConnections under a single manager.
Useful when you need to handle many peers simultaneously — for example a server accepting connections from multiple clients, or a client maintaining connections to multiple servers.
§Example
use vcl_protocol::pool::VCLPool;
#[tokio::main]
async fn main() {
let mut pool = VCLPool::new(10);
let id = pool.bind("127.0.0.1:0").await.unwrap();
pool.connect(id, "127.0.0.1:8080").await.unwrap();
pool.send(id, b"Hello from pool!").await.unwrap();
let packet = pool.recv(id).await.unwrap();
println!("{}", String::from_utf8_lossy(&packet.payload));
pool.close(id).unwrap();
}Structs§
- VCLPool
- Manages multiple
VCLConnections under a single pool.
Type Aliases§
- Connection
Id - A unique identifier for a connection inside a
VCLPool.