pub trait RuntimeInterface: Sized {
Show 27 associated items
type JoinHandle<T: Send + 'static>: Future<Output = T> + Send + 'static;
type MpscSender<T: Send + 'static>: MpscSender<T> + 'static;
type MpscReceiver<T: Send + 'static>: MpscReceiver<T> + 'static;
type OneshotSender<T: Send + 'static>: OneshotSender<T> + 'static;
type OneshotReceiver<T: Send + 'static>: Future<Output = Result<T, OneshotRecvError>> + Send + 'static;
type BroadcastSender<T: Send + Clone + 'static>: BroadcastSender<T> + 'static;
type BroadcastReceiver<T: Send + Clone + 'static>: BroadcastReceiver<T> + 'static;
type WatchSender<T: Send + Sync + 'static>: WatchSender<T> + 'static;
type WatchReceiver<T: Send + Sync + Clone + 'static>: WatchReceiver<T> + 'static;
type File: AsyncFile + 'static;
type TcpListener: TcpListener<Stream = Self::TcpStream> + 'static;
type TcpStream: TcpStream + 'static;
type UdpSocket: UdpSocket + 'static;
// Required methods
fn spawn<F>(&self, future: F) -> Self::JoinHandle<F::Output>
where F: Future + Send + 'static,
F::Output: Send + 'static;
fn block_on<F: Future>(&self, future: F) -> F::Output;
fn sleep(
&self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
fn timeout<'a, F: Future + Send + 'a>(
&'a self,
duration: Duration,
future: F,
) -> Pin<Box<dyn Future<Output = Result<F::Output, TimeoutError>> + Send + 'a>>
where F::Output: Send;
fn mpsc_channel<T: Send + 'static>(
&self,
capacity: usize,
) -> (Self::MpscSender<T>, Self::MpscReceiver<T>);
fn oneshot_channel<T: Send + 'static>(
&self,
) -> (Self::OneshotSender<T>, Self::OneshotReceiver<T>);
fn broadcast_channel<T: Send + Clone + 'static>(
&self,
capacity: usize,
) -> (Self::BroadcastSender<T>, Self::BroadcastReceiver<T>);
fn watch_channel<T: Send + Sync + Clone + 'static>(
&self,
initial: T,
) -> (Self::WatchSender<T>, Self::WatchReceiver<T>);
fn file_create<'a>(
&'a self,
path: &'a Path,
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'a>>;
fn file_open<'a>(
&'a self,
path: &'a Path,
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'a>>;
fn tcp_listen<'a>(
&'a self,
addr: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Self::TcpListener>> + Send + 'a>>;
fn tcp_connect<'a>(
&'a self,
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self::TcpStream>> + Send + 'a>>;
fn udp_bind<'a>(
&'a self,
addr: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Self::UdpSocket>> + Send + 'a>>;
// Provided method
fn bench_alloc_snapshot(&self) -> Option<BenchAllocSnapshot> { ... }
}Expand description
Trait that async runtimes must implement to run conformance tests.
This trait provides the common primitives that tests require. Each method returns a concrete type that the runtime provides.
Required Associated Types§
Sourcetype JoinHandle<T: Send + 'static>: Future<Output = T> + Send + 'static
type JoinHandle<T: Send + 'static>: Future<Output = T> + Send + 'static
Join handle for spawned tasks.
Sourcetype MpscSender<T: Send + 'static>: MpscSender<T> + 'static
type MpscSender<T: Send + 'static>: MpscSender<T> + 'static
MPSC sender.
Sourcetype MpscReceiver<T: Send + 'static>: MpscReceiver<T> + 'static
type MpscReceiver<T: Send + 'static>: MpscReceiver<T> + 'static
MPSC receiver.
Sourcetype OneshotSender<T: Send + 'static>: OneshotSender<T> + 'static
type OneshotSender<T: Send + 'static>: OneshotSender<T> + 'static
Oneshot sender.
Sourcetype OneshotReceiver<T: Send + 'static>: Future<Output = Result<T, OneshotRecvError>> + Send + 'static
type OneshotReceiver<T: Send + 'static>: Future<Output = Result<T, OneshotRecvError>> + Send + 'static
Oneshot receiver.
Sourcetype BroadcastSender<T: Send + Clone + 'static>: BroadcastSender<T> + 'static
type BroadcastSender<T: Send + Clone + 'static>: BroadcastSender<T> + 'static
Broadcast sender.
Sourcetype BroadcastReceiver<T: Send + Clone + 'static>: BroadcastReceiver<T> + 'static
type BroadcastReceiver<T: Send + Clone + 'static>: BroadcastReceiver<T> + 'static
Broadcast receiver.
Sourcetype WatchSender<T: Send + Sync + 'static>: WatchSender<T> + 'static
type WatchSender<T: Send + Sync + 'static>: WatchSender<T> + 'static
Watch sender.
Sourcetype WatchReceiver<T: Send + Sync + Clone + 'static>: WatchReceiver<T> + 'static
type WatchReceiver<T: Send + Sync + Clone + 'static>: WatchReceiver<T> + 'static
Watch receiver.
Sourcetype TcpListener: TcpListener<Stream = Self::TcpStream> + 'static
type TcpListener: TcpListener<Stream = Self::TcpStream> + 'static
TCP listener.
Required Methods§
Sourcefn spawn<F>(&self, future: F) -> Self::JoinHandle<F::Output>
fn spawn<F>(&self, future: F) -> Self::JoinHandle<F::Output>
Spawn an async task.
Sourcefn sleep(
&self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn sleep( &self, duration: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Sleep for a duration.
Sourcefn timeout<'a, F: Future + Send + 'a>(
&'a self,
duration: Duration,
future: F,
) -> Pin<Box<dyn Future<Output = Result<F::Output, TimeoutError>> + Send + 'a>>
fn timeout<'a, F: Future + Send + 'a>( &'a self, duration: Duration, future: F, ) -> Pin<Box<dyn Future<Output = Result<F::Output, TimeoutError>> + Send + 'a>>
Run a future with a timeout.
Sourcefn mpsc_channel<T: Send + 'static>(
&self,
capacity: usize,
) -> (Self::MpscSender<T>, Self::MpscReceiver<T>)
fn mpsc_channel<T: Send + 'static>( &self, capacity: usize, ) -> (Self::MpscSender<T>, Self::MpscReceiver<T>)
Create an MPSC channel with the given capacity.
Sourcefn oneshot_channel<T: Send + 'static>(
&self,
) -> (Self::OneshotSender<T>, Self::OneshotReceiver<T>)
fn oneshot_channel<T: Send + 'static>( &self, ) -> (Self::OneshotSender<T>, Self::OneshotReceiver<T>)
Create a oneshot channel.
Sourcefn broadcast_channel<T: Send + Clone + 'static>(
&self,
capacity: usize,
) -> (Self::BroadcastSender<T>, Self::BroadcastReceiver<T>)
fn broadcast_channel<T: Send + Clone + 'static>( &self, capacity: usize, ) -> (Self::BroadcastSender<T>, Self::BroadcastReceiver<T>)
Create a broadcast channel.
Sourcefn watch_channel<T: Send + Sync + Clone + 'static>(
&self,
initial: T,
) -> (Self::WatchSender<T>, Self::WatchReceiver<T>)
fn watch_channel<T: Send + Sync + Clone + 'static>( &self, initial: T, ) -> (Self::WatchSender<T>, Self::WatchReceiver<T>)
Create a watch channel.
Sourcefn file_create<'a>(
&'a self,
path: &'a Path,
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'a>>
fn file_create<'a>( &'a self, path: &'a Path, ) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'a>>
Create a file for writing.
Sourcefn file_open<'a>(
&'a self,
path: &'a Path,
) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'a>>
fn file_open<'a>( &'a self, path: &'a Path, ) -> Pin<Box<dyn Future<Output = Result<Self::File>> + Send + 'a>>
Open a file for reading.
Sourcefn tcp_listen<'a>(
&'a self,
addr: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Self::TcpListener>> + Send + 'a>>
fn tcp_listen<'a>( &'a self, addr: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Self::TcpListener>> + Send + 'a>>
Bind a TCP listener to an address.
Sourcefn tcp_connect<'a>(
&'a self,
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<Self::TcpStream>> + Send + 'a>>
fn tcp_connect<'a>( &'a self, addr: SocketAddr, ) -> Pin<Box<dyn Future<Output = Result<Self::TcpStream>> + Send + 'a>>
Connect to a TCP address.
Provided Methods§
Sourcefn bench_alloc_snapshot(&self) -> Option<BenchAllocSnapshot>
fn bench_alloc_snapshot(&self) -> Option<BenchAllocSnapshot>
Snapshot allocation counters for benchmarking (if supported).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".