Expand description
nexus-async-net — async adapters for nexus-net.
Thin async wrappers over nexus-net’s synchronous protocol primitives.
Same zero-copy parsing, same performance — just .await on I/O.
§Runtime Features
Exactly one async runtime must be enabled (mutually exclusive):
tokio-rt(default) — tokio-based adapters for WebSocket and REST.nexus— nexus-async-rt-based adapters (single-threaded, pre-allocated). (Renamed fromnexus-rtin v0.4.2.)
§Modules
ws— Async WebSocket (wraps FrameReader/FrameWriter). Both backends providerecv()/send_*(). The tokio backend also implementsStream/Sinkfor ecosystem integration.rest— Async HTTP REST client (wraps RequestWriter/ResponseReader)
§Custom transports
WsReader/WsWriter and HttpConnection<S> accept any
WireStream — the canonical MaybeTls
transport implements it directly. To plug a custom
AsyncRead+AsyncWrite transport into the same API, wrap it at
the call site:
- tokio (
feature = "tokio-rt"):AsyncReadAdapter - nexus-async-rt (
feature = "nexus"): [NexusAsyncReadAdapter]
ⓘ
let tcp = tokio::net::TcpStream::connect(addr).await?;
let (mut reader, mut writer, mut conn) = WsStreamBuilder::new()
.connect_with(AsyncReadAdapter::new(tcp), url)
.await?;Modules§
- rest
- Async HTTP REST client — adapts nexus-net for async runtimes.
- rest_
types - REST types used in
rest::HttpConnectionandrest::ClientSlot. - ws
- Async WebSocket — adapts nexus-net for async runtimes.
Structs§
- Async
Read Adapter - Wraps a
tokio::io::AsyncRead + AsyncWritesource as aWireStream. - Close
Frame - Parsed close frame: status code + UTF-8 reason.
- Frame
Reader - WebSocket frame reader — parses wire bytes into
Messages. - Frame
Reader Builder - Builder for
FrameReader. - Frame
Writer - WebSocket frame encoder.
- Owned
Close Frame - Owned close frame.
- TlsConfig
- Shared TLS configuration. Create once at startup, pass to each connection.
- Write
Buf - Flat byte slab for outbound protocol frames.
Enums§
- Close
Code - WebSocket close status codes (RFC 6455 §7.4.1).
- Handshake
Error - Handshake error.
- Message
- A complete WebSocket message.
- Owned
Message - An owned WebSocket message, detached from reader buffers.
- Role
- Determines masking behavior per RFC 6455.
- TlsError
- TLS operation error.
- WsError
- Unified error type for WebSocket stream operations.
Traits§
- Wire
Stream - A bidirectional byte-level stream that fills a parser’s buffer.