Skip to main content

QuicRuntime

Trait QuicRuntime 

pub trait QuicRuntime:
    Send
    + Sync
    + Debug
    + 'static {
    // Required methods
    fn new_timer(&self, i: Instant) -> Pin<Box<dyn AsyncTimer>>;
    fn spawn(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>);
    fn wrap_udp_socket(
        &self,
        t: UdpSocket,
    ) -> Result<Arc<dyn AsyncUdpSocket>, Error>;

    // Provided method
    fn now(&self) -> Instant { ... }
}
Expand description

quinn’s runtime: spawns its tasks, and gives its timers and UDP sockets. Implement it to run QUIC on your own I/O reactor. Abstracts I/O and timer operations for runtime independence

Required Methods§

fn new_timer(&self, i: Instant) -> Pin<Box<dyn AsyncTimer>>

Construct a timer that will expire at i

fn spawn(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>)

Drive future to completion in the background

fn wrap_udp_socket( &self, t: UdpSocket, ) -> Result<Arc<dyn AsyncUdpSocket>, Error>

Convert t into the socket type used by this runtime

Provided Methods§

fn now(&self) -> Instant

Look up the current time

Allows simulating the flow of time for testing.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Runtime for ExecutorRuntime

§

impl Runtime for TokioRuntime