Expand description
A compatibility layer for using quinn with the vibeio async runtime.
This crate provides the necessary runtime adapters to run QUIC-based
applications built on quinn on top of vibeio. It implements the
traits required by quinn’s runtime abstraction:
VibeioRuntime: A runtime that implementsquinn::Runtimeusingvibeio’s task spawning, timer, and I/O primitives.
§Overview
VibeioRuntime satisfies all three abstract interfaces that quinn
requires from a runtime:
quinn trait | Implementation |
|---|---|
quinn::Runtime | VibeioRuntime struct |
quinn::AsyncTimer | Internal wrapper around vibeio::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 vibeio_quinn::VibeioRuntime;
let runtime = Arc::new(VibeioRuntime);
let mut endpoint = Endpoint::new(
EndpointConfig::default(),
None,
runtime,
)?;§Architecture notes
vibeio 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
vibeio 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 vibeio runtime context.
Structs§
- Vibeio
Runtime - A
quinn::Runtimeimplementation for thevibeioasync runtime.