Expand description
A compatibility layer for using quinn with the zincio async runtime.
This crate provides the necessary runtime adapters to run QUIC-based
applications built on quinn on top of zincio. It implements the
traits required by quinn’s runtime abstraction:
ZincioRuntime: A runtime that implementsquinn::Runtimeusingzincio’s task spawning, timer, and I/O primitives.
§Overview
ZincioRuntime satisfies all three abstract interfaces that quinn
requires from a runtime:
quinn trait | Implementation |
|---|---|
quinn::Runtime | ZincioRuntime struct |
quinn::AsyncTimer | Internal wrapper around zincio::time::Sleep |
quinn::AsyncUdpSocket | Internal wrapper combining PollUdpSocket + quinn-udp batching |
quinn::UdpPoller | Internal type backed by AsyncWritePoll readiness |
§Usage
use quinn::{Endpoint, EndpointConfig, ServerConfig};
use std::sync::Arc;
use zincio_quinn::ZincioRuntime;
let runtime = Arc::new(ZincioRuntime);
let mut endpoint = Endpoint::new(
EndpointConfig::default(),
None,
runtime,
)?;§Architecture notes
zincio is a single-threaded runtime. All spawned futures and I/O
operations execute on the thread that owns the runtime. The internal I/O
handle types use Rc<AnyDriver> internally and are therefore !Send and
!Sync. To satisfy quinn’s Send + Sync + 'static bounds on its
runtime traits, the adapters in this crate use unsafe impl Send + Sync
under the justification that the runtime’s single-threaded architecture
prevents data races.
Each quinn Endpoint should be driven from a single
zincio task (e.g. via endpoint.run_until_stopped() or manual polling).
The UDP socket, timer, and task spawn implementations all assume they are
used from the thread associated with the current zincio runtime context.
Structs§
- Zincio
Runtime - A
quinn::Runtimeimplementation for thezincioasync runtime.