Trait kvarn_quinn::Runtime
source · pub trait Runtime: 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>>;
}
Expand description
Abstracts I/O and timer operations for runtime independence
Required Methods§
sourcefn new_timer(&self, i: Instant) -> Pin<Box<dyn AsyncTimer>>
fn new_timer(&self, i: Instant) -> Pin<Box<dyn AsyncTimer>>
Construct a timer that will expire at i
sourcefn spawn(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>)
fn spawn(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>)
Drive future
to completion in the background
sourcefn wrap_udp_socket(&self, t: UdpSocket) -> Result<Arc<dyn AsyncUdpSocket>>
fn wrap_udp_socket(&self, t: UdpSocket) -> Result<Arc<dyn AsyncUdpSocket>>
Convert t
into the socket type used by this runtime