pub trait RuntimeLite: Sized + Unpin + Copy + Send + Sync + 'static {
Show 42 associated items type Spawner: AsyncSpawner; type LocalSpawner: AsyncLocalSpawner; type BlockingSpawner: AsyncBlockingSpawner; type AfterSpawner: AsyncAfterSpawner; type LocalAfterSpawner: AsyncLocalAfterSpawner; type Interval: AsyncInterval; type LocalInterval: AsyncLocalInterval; type Sleep: AsyncSleep; type LocalSleep: AsyncLocalSleep; type Delay<F>: AsyncDelay<F> where F: Future + Send; type LocalDelay<F>: AsyncLocalDelay<F> where F: Future; type Timeout<F>: AsyncTimeout<F> where F: Future + Send; type LocalTimeout<F>: AsyncLocalTimeout<F> where F: Future; // Required methods fn new() -> Self; fn block_on<F: Future>(f: F) -> F::Output; fn yield_now() -> impl Future<Output = ()> + Send; fn interval(interval: Duration) -> Self::Interval; fn interval_at(start: Instant, period: Duration) -> Self::Interval; fn interval_local(interval: Duration) -> Self::LocalInterval; fn interval_local_at( start: Instant, period: Duration ) -> Self::LocalInterval; fn sleep(duration: Duration) -> Self::Sleep; fn sleep_until(instant: Instant) -> Self::Sleep; fn sleep_local(duration: Duration) -> Self::LocalSleep; fn sleep_local_until(instant: Instant) -> Self::LocalSleep; fn delay<F>(duration: Duration, fut: F) -> Self::Delay<F> where F: Future + Send; fn delay_local<F>(duration: Duration, fut: F) -> Self::LocalDelay<F> where F: Future; fn delay_at<F>(deadline: Instant, fut: F) -> Self::Delay<F> where F: Future + Send; fn delay_local_at<F>(deadline: Instant, fut: F) -> Self::LocalDelay<F> where F: Future; // Provided methods fn spawn<F>( future: F ) -> <Self::Spawner as AsyncSpawner>::JoinHandle<F::Output> where F::Output: Send + 'static, F: Future + Send + 'static { ... } fn spawn_detach<F>(future: F) where F::Output: Send + 'static, F: Future + Send + 'static { ... } fn spawn_local<F>( future: F ) -> <Self::LocalSpawner as AsyncLocalSpawner>::JoinHandle<F::Output> where F: Future + 'static, F::Output: 'static { ... } fn spawn_local_detach<F>(future: F) where F: Future + 'static, F::Output: 'static { ... } fn spawn_blocking<F, R>( f: F ) -> <Self::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<R> where F: FnOnce() -> R + Send + 'static, R: Send + 'static { ... } fn spawn_blocking_detach<F, R>(f: F) where F: FnOnce() -> R + Send + 'static, R: Send + 'static { ... } fn spawn_after<F>( duration: Duration, future: F ) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<F::Output> where F::Output: Send + 'static, F: Future + Send + 'static { ... } fn spawn_after_at<F>( at: Instant, future: F ) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<F::Output> where F::Output: Send + 'static, F: Future + Send + 'static { ... } fn spawn_local_after<F>( duration: Duration, future: F ) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<F::Output> where F::Output: Send + 'static, F: Future + Send + 'static { ... } fn spawn_local_after_at<F>( at: Instant, future: F ) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<F::Output> where F::Output: Send + 'static, F: Future + Send + 'static { ... } fn timeout<F>(duration: Duration, future: F) -> Self::Timeout<F> where F: Future + Send { ... } fn timeout_at<F>(deadline: Instant, future: F) -> Self::Timeout<F> where F: Future + Send { ... } fn timeout_local<F>(duration: Duration, future: F) -> Self::LocalTimeout<F> where F: Future { ... } fn timeout_local_at<F>( deadline: Instant, future: F ) -> Self::LocalTimeout<F> where F: Future { ... }
}
Expand description

Runtime trait

Required Associated Types§

source

type Spawner: AsyncSpawner

The spawner type for this runtime

source

type LocalSpawner: AsyncLocalSpawner

The local spawner type for this runtime

source

type BlockingSpawner: AsyncBlockingSpawner

The blocking spawner type for this runtime

source

type AfterSpawner: AsyncAfterSpawner

Available on crate feature time only.

The after spawner type for this runtime

source

type LocalAfterSpawner: AsyncLocalAfterSpawner

Available on crate feature time only.

The local after spawner type for this runtime

source

type Interval: AsyncInterval

Available on crate feature time only.

The interval type for this runtime

source

type LocalInterval: AsyncLocalInterval

Available on crate feature time only.

The local interval type for this runtime

source

type Sleep: AsyncSleep

Available on crate feature time only.

The sleep type for this runtime

source

type LocalSleep: AsyncLocalSleep

Available on crate feature time only.

The local sleep type for this runtime

source

type Delay<F>: AsyncDelay<F> where F: Future + Send

Available on crate feature time only.

The delay type for this runtime

source

type LocalDelay<F>: AsyncLocalDelay<F> where F: Future

Available on crate feature time only.

The local delay type for this runtime

source

type Timeout<F>: AsyncTimeout<F> where F: Future + Send

Available on crate feature time only.

The timeout type for this runtime

source

type LocalTimeout<F>: AsyncLocalTimeout<F> where F: Future

Available on crate feature time only.

The local timeout type for this runtime

Required Methods§

source

fn new() -> Self

Create a new instance of the runtime

source

fn block_on<F: Future>(f: F) -> F::Output

Block the current thread on the given future

source

fn yield_now() -> impl Future<Output = ()> + Send

Yield the current task

source

fn interval(interval: Duration) -> Self::Interval

Available on crate feature time only.

Create a new interval that starts at the current time and yields every period duration

source

fn interval_at(start: Instant, period: Duration) -> Self::Interval

Available on crate feature time only.

Create a new interval that starts at the given instant and yields every period duration

source

fn interval_local(interval: Duration) -> Self::LocalInterval

Available on crate feature time only.

Create a new interval that starts at the current time and yields every period duration

source

fn interval_local_at(start: Instant, period: Duration) -> Self::LocalInterval

Available on crate feature time only.

Create a new interval that starts at the given instant and yields every period duration

source

fn sleep(duration: Duration) -> Self::Sleep

Available on crate feature time only.

Create a new sleep future that completes after the given duration has elapsed

source

fn sleep_until(instant: Instant) -> Self::Sleep

Available on crate feature time only.

Create a new sleep future that completes at the given instant has elapsed

source

fn sleep_local(duration: Duration) -> Self::LocalSleep

Available on crate feature time only.

Create a new sleep future that completes after the given duration has elapsed

source

fn sleep_local_until(instant: Instant) -> Self::LocalSleep

Available on crate feature time only.

Create a new sleep future that completes at the given instant has elapsed

source

fn delay<F>(duration: Duration, fut: F) -> Self::Delay<F>
where F: Future + Send,

Available on crate feature time only.

Create a new delay future that runs the fut after the given duration has elapsed. The Future will never be polled until the duration has elapsed.

The behavior of this function may different in different runtime implementations.

source

fn delay_local<F>(duration: Duration, fut: F) -> Self::LocalDelay<F>
where F: Future,

Available on crate feature time only.

Like delay, but does not require the fut to be Send. Create a new delay future that runs the fut after the given duration has elapsed. The Future will never be polled until the duration has elapsed.

The behavior of this function may different in different runtime implementations.

source

fn delay_at<F>(deadline: Instant, fut: F) -> Self::Delay<F>
where F: Future + Send,

Available on crate feature time only.

Create a new timeout future that runs the future after the given deadline. The Future will never be polled until the deadline has reached.

The behavior of this function may different in different runtime implementations.

source

fn delay_local_at<F>(deadline: Instant, fut: F) -> Self::LocalDelay<F>
where F: Future,

Available on crate feature time only.

Like delay_at, but does not require the fut to be Send. Create a new timeout future that runs the future after the given deadline The Future will never be polled until the deadline has reached.

The behavior of this function may different in different runtime implementations.

Provided Methods§

source

fn spawn<F>(future: F) -> <Self::Spawner as AsyncSpawner>::JoinHandle<F::Output>
where F::Output: Send + 'static, F: Future + Send + 'static,

Spawn a future onto the runtime

source

fn spawn_detach<F>(future: F)
where F::Output: Send + 'static, F: Future + Send + 'static,

Spawn a future onto the runtime and detach it

source

fn spawn_local<F>( future: F ) -> <Self::LocalSpawner as AsyncLocalSpawner>::JoinHandle<F::Output>
where F: Future + 'static, F::Output: 'static,

Spawn a future onto the local runtime

source

fn spawn_local_detach<F>(future: F)
where F: Future + 'static, F::Output: 'static,

Spawn a future onto the local runtime and detach it

source

fn spawn_blocking<F, R>( f: F ) -> <Self::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<R>
where F: FnOnce() -> R + Send + 'static, R: Send + 'static,

Spawn a blocking function onto the runtime

source

fn spawn_blocking_detach<F, R>(f: F)
where F: FnOnce() -> R + Send + 'static, R: Send + 'static,

Spawn a blocking function onto the runtime and detach it

source

fn spawn_after<F>( duration: Duration, future: F ) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<F::Output>
where F::Output: Send + 'static, F: Future + Send + 'static,

Available on crate feature time only.

Spawn a future onto the runtime and run the given future after the given duration

source

fn spawn_after_at<F>( at: Instant, future: F ) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<F::Output>
where F::Output: Send + 'static, F: Future + Send + 'static,

Available on crate feature time only.

Spawn a future onto the runtime and run the given future after the given instant.

source

fn spawn_local_after<F>( duration: Duration, future: F ) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<F::Output>
where F::Output: Send + 'static, F: Future + Send + 'static,

Available on crate feature time only.

Like spawn_after, but does not require the future to be Send.

Spawn a future onto the runtime and run the given future after the given duration

source

fn spawn_local_after_at<F>( at: Instant, future: F ) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<F::Output>
where F::Output: Send + 'static, F: Future + Send + 'static,

Available on crate feature time only.

Like spawn_after_at, but does not require the future to be Send.

Spawn a future onto the runtime and run the given future after the given instant.

source

fn timeout<F>(duration: Duration, future: F) -> Self::Timeout<F>
where F: Future + Send,

Available on crate feature time only.

Requires a Future to complete before the specified duration has elapsed.

The behavior of this function may different in different runtime implementations.

source

fn timeout_at<F>(deadline: Instant, future: F) -> Self::Timeout<F>
where F: Future + Send,

Available on crate feature time only.

Requires a Future to complete before the specified instant in time.

The behavior of this function may different in different runtime implementations.

source

fn timeout_local<F>(duration: Duration, future: F) -> Self::LocalTimeout<F>
where F: Future,

Available on crate feature time only.

Like timeout, but does not requrie the future to be Send. Requires a Future to complete before the specified duration has elapsed.

The behavior of this function may different in different runtime implementations.

source

fn timeout_local_at<F>(deadline: Instant, future: F) -> Self::LocalTimeout<F>
where F: Future,

Available on crate feature time only.

Like timeout_at, but does not requrie the future to be Send. Requires a Future to complete before the specified duration has elapsed.

The behavior of this function may different in different runtime implementations.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl RuntimeLite for AsyncStdRuntime

Available on crate feature async-std only.
source§

impl RuntimeLite for SmolRuntime

Available on crate feature smol only.
source§

impl RuntimeLite for TokioRuntime

Available on crate feature tokio only.
source§

impl RuntimeLite for WasmRuntime

Available on crate feature wasm only.