Skip to main content

Module memory

Module memory 

Source
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§

MemoryConfig
Configuration for memory transport.
MemorySender
Sender handle for injecting test messages.
MemoryToken
Commit token for memory transport.
MemoryTransport
In-memory transport using tokio channels.