A reusable client: validated Config plus optional session policy. Every field
has a default — config falls back to Config.default — so construct with .{ }
and set only what you need; there is no build step:
Database 0 is the default, expressed by leaving select_db unset; a positive
index excludes 0, so select_db: Present(0) is a compile-time error by design.
attach pure — bind a live transport into a Connection (no I/O).
handshake! effect — run the session setup (AUTH, SELECT) a fresh socket
needs; run once per socket.
connect! effect — attach then handshake!, the batteries-included path.
A pool runs handshake! once when it dials a fresh socket and only attach
on each subsequent reuse. The client owns Redis session identity; the
platform owns the socket, its lifecycle, deadlines, and TLS.
Bind a live transport into a Connection. Pure: no I/O and no handshake.
Use for a reused socket whose session is already established, or when you
will run handshake! yourself.
Run the session handshake (AUTH then SELECT, as configured) over an
already-attached connection. Run once per fresh socket. On any error the
caller MUST discard the socket: Rejected means a clean frame but an
unusable session (usually permanent, e.g. a bad password); ExchangeFailed
means the transport failed mid-handshake and framing is ambiguous.