Available on crate features
transport-memory and transport only.Expand description
§Memory Transport
In-memory transport using tokio channels for unit testing. No persistence, same-process only.
§Example
ⓘ
use hyperi_rustlib::transport::{MemoryTransport, MemoryConfig, Transport};
let config = MemoryConfig::default();
let transport = MemoryTransport::new(&config).expect("memory transport with valid config must construct");
// In tests, you can also get a sender handle
let sender = transport.sender();
sender.send(b"test payload".to_vec()).await?;
let records = transport.recv(10).await?.records;
assert_eq!(records.len(), 1);Structs§
- Memory
Config - Configuration for memory transport.
- Memory
Sender - Sender handle for injecting test messages.
- Memory
Token - Commit token for memory transport.
- Memory
Transport - In-memory transport using tokio channels.