Expand description
An in-memory poll::Session pair: two peers in one process, no sockets or crypto.
Each stream is a channel of Bytes messages: a write queues one message and a read
hands it back, the same allocation, so a payload crosses without a copy. A read with a
smaller limit splits the message, still without a copy.
Each stream’s channel is bounded by Config::stream_buffer queued bytes, and a write
pends while it is full, so a slow reader throttles only its own stream. A write is
never split: one accepted while the channel has room may overshoot the bound.
Config::max_concurrent_uni_streams and Config::max_concurrent_bi_streams bound
the streams each side has open toward its peer, as QUIC’s stream credit does: an open
pends until the peer is done with one.
finish closes the channel cleanly once its messages are
read. A reset or stop closes it
with a code and drops what it queued, except that a
reset_at keeps the bytes before its offset for the reader
ahead of the code. Closing the session keeps queued messages
readable, and leaves streams as they were, so the peer reads them, then the close.
Reads return the channel’s room as they go, so streams lease through
Buffered and are not bounded by a receive window.
Datagrams ignore their send options, and are dropped when oversized or when the peer’s queue is full, as a network would.
Config::latency delays each stream message and finish on the ambient clock, so
a mesh of pairs orders its traffic as a network of that latency would. Opens,
resets, stops, datagrams, and the session close skip it.
Structs§
- Chunks
- The plain reads of an in-memory stream.
- Closer
- Closes a
Sessionfrom outside it, holding neither side open: the session still closes once both of its handles drop. - Config
- The options both sides of a
pairshare. - Send
Stream - The writing half of an in-memory stream.
- Session
- One side of an in-memory session, created by
pair.
Enums§
- Error
- A transport failure: a session close, or a stream’s reset or stop.
Functions§
- pair
- Create two connected sessions: streams one opens, the other accepts.
Type Aliases§
- Recv
Stream - The reading half of an in-memory stream, leased through
poll::Buffered.