Expand description
A compatibility layer for using hyper with the vibeio async runtime.
This crate provides the necessary adapters to run hyper-based HTTP servers
and clients on top of vibeio instead of tokio. It implements the traits
required by hyper’s runtime abstraction:
VibeioExecutor: An executor that spawns tasks on thevibeioruntime usingvibeio::spawn.VibeioTimer: A timer that usesvibeio::time::sleepfor delay operations.VibeioIo: A wrapper type that adaptsvibeio’s I/O types to implementhyper’sReadandWritetraits, and also implementstokio’sAsyncReadandAsyncWritetraits for compatibility.
§Overview
This crate enables hyper to work with vibeio by implementing hyper’s
runtime traits (Executor, Timer, Read, Write, Sleep) in terms of
vibeio primitives.
§Executor
The VibeioExecutor type implements hyper::rt::Executor by spawning
futures onto the vibeio runtime via vibeio::spawn.
§Timer
The VibeioTimer type implements hyper::rt::Timer by converting sleep
requests into vibeio::time::sleep futures wrapped in a compatible type.
§I/O Adapters
The VibeioIo<T> wrapper adapts any type that implements tokio::io::AsyncRead
and tokio::io::AsyncWrite to work with hyper’s I/O traits. It also
implements the reverse conversion, allowing hyper’s I/O types to be used
with tokio-style async functions.
§Implementation notes
- The
VibeioIowrapper usesPin<Box<T>>internally to support the trait implementations required byhyperandtokio. - The
VibeioSleeptype (internal) implements bothhyper::rt::Sleepandstd::future::Futureto bridge the two runtimes’ sleep abstractions. - Timer handles are properly cancelled when
VibeioSleepis dropped to avoid resource leaks.
Structs§
- Vibeio
Executor - An executor that spawns tasks onto the
vibeioruntime. - Vibeio
Io - A wrapper type that adapts I/O types for use with
hyperandtokio. - Vibeio
Timer - A timer that uses
vibeio’s time utilities for sleep operations.