Trait agnostic::RuntimeLite
source · 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: Future + Send>: AsyncDelay<F>;
type LocalDelay<F: Future>: AsyncLocalDelay<F>;
type Timeout<F: Future + Send>: AsyncTimeout<F>;
type LocalTimeout<F: Future>: AsyncLocalTimeout<F>;
// Required methods
fn new() -> Self;
fn block_on<F>(f: F) -> <F as Future>::Output
where F: Future;
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 as Future>::Output>
where <F as Future>::Output: Send + 'static,
F: Future + Send + 'static { ... }
fn spawn_detach<F>(future: F)
where <F as Future>::Output: Send + 'static,
F: Future + Send + 'static { ... }
fn spawn_local<F>(
future: F
) -> <Self::LocalSpawner as AsyncLocalSpawner>::JoinHandle<<F as Future>::Output>
where F: Future + 'static,
<F as Future>::Output: 'static { ... }
fn spawn_local_detach<F>(future: F)
where F: Future + 'static,
<F as Future>::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 as Future>::Output>
where <F as Future>::Output: Send + 'static,
F: Future + Send + 'static { ... }
fn spawn_after_at<F>(
at: Instant,
future: F
) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<<F as Future>::Output>
where <F as Future>::Output: Send + 'static,
F: Future + Send + 'static { ... }
fn spawn_local_after<F>(
duration: Duration,
future: F
) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<<F as Future>::Output>
where <F as Future>::Output: Send + 'static,
F: Future + Send + 'static { ... }
fn spawn_local_after_at<F>(
at: Instant,
future: F
) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<<F as Future>::Output>
where <F as Future>::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§
sourcetype Spawner: AsyncSpawner
type Spawner: AsyncSpawner
The spawner type for this runtime
sourcetype LocalSpawner: AsyncLocalSpawner
type LocalSpawner: AsyncLocalSpawner
The local spawner type for this runtime
sourcetype BlockingSpawner: AsyncBlockingSpawner
type BlockingSpawner: AsyncBlockingSpawner
The blocking spawner type for this runtime
sourcetype AfterSpawner: AsyncAfterSpawner
type AfterSpawner: AsyncAfterSpawner
The after spawner type for this runtime
sourcetype LocalAfterSpawner: AsyncLocalAfterSpawner
type LocalAfterSpawner: AsyncLocalAfterSpawner
The local after spawner type for this runtime
sourcetype Interval: AsyncInterval
type Interval: AsyncInterval
The interval type for this runtime
sourcetype LocalInterval: AsyncLocalInterval
type LocalInterval: AsyncLocalInterval
The local interval type for this runtime
sourcetype Sleep: AsyncSleep
type Sleep: AsyncSleep
The sleep type for this runtime
sourcetype LocalSleep: AsyncLocalSleep
type LocalSleep: AsyncLocalSleep
The local sleep type for this runtime
sourcetype Delay<F: Future + Send>: AsyncDelay<F>
type Delay<F: Future + Send>: AsyncDelay<F>
The delay type for this runtime
sourcetype LocalDelay<F: Future>: AsyncLocalDelay<F>
type LocalDelay<F: Future>: AsyncLocalDelay<F>
The local delay type for this runtime
sourcetype Timeout<F: Future + Send>: AsyncTimeout<F>
type Timeout<F: Future + Send>: AsyncTimeout<F>
The timeout type for this runtime
sourcetype LocalTimeout<F: Future>: AsyncLocalTimeout<F>
type LocalTimeout<F: Future>: AsyncLocalTimeout<F>
The local timeout type for this runtime
Required Methods§
sourcefn block_on<F>(f: F) -> <F as Future>::Outputwhere
F: Future,
fn block_on<F>(f: F) -> <F as Future>::Outputwhere
F: Future,
Block the current thread on the given future
sourcefn interval(interval: Duration) -> Self::Interval
fn interval(interval: Duration) -> Self::Interval
Create a new interval that starts at the current time and
yields every period duration
sourcefn interval_at(start: Instant, period: Duration) -> Self::Interval
fn interval_at(start: Instant, period: Duration) -> Self::Interval
Create a new interval that starts at the given instant and
yields every period duration
sourcefn interval_local(interval: Duration) -> Self::LocalInterval
fn interval_local(interval: Duration) -> Self::LocalInterval
Create a new interval that starts at the current time and
yields every period duration
sourcefn interval_local_at(start: Instant, period: Duration) -> Self::LocalInterval
fn interval_local_at(start: Instant, period: Duration) -> Self::LocalInterval
Create a new interval that starts at the given instant and
yields every period duration
sourcefn sleep(duration: Duration) -> Self::Sleep
fn sleep(duration: Duration) -> Self::Sleep
Create a new sleep future that completes after the given duration has elapsed
sourcefn sleep_until(instant: Instant) -> Self::Sleep
fn sleep_until(instant: Instant) -> Self::Sleep
Create a new sleep future that completes at the given instant has elapsed
sourcefn sleep_local(duration: Duration) -> Self::LocalSleep
fn sleep_local(duration: Duration) -> Self::LocalSleep
Create a new sleep future that completes after the given duration has elapsed
sourcefn sleep_local_until(instant: Instant) -> Self::LocalSleep
fn sleep_local_until(instant: Instant) -> Self::LocalSleep
Create a new sleep future that completes at the given instant has elapsed
sourcefn delay<F>(duration: Duration, fut: F) -> Self::Delay<F>
fn delay<F>(duration: Duration, fut: F) -> Self::Delay<F>
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.
sourcefn delay_local<F>(duration: Duration, fut: F) -> Self::LocalDelay<F>where
F: Future,
fn delay_local<F>(duration: Duration, fut: F) -> Self::LocalDelay<F>where
F: Future,
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.
sourcefn delay_at<F>(deadline: Instant, fut: F) -> Self::Delay<F>
fn delay_at<F>(deadline: Instant, fut: F) -> Self::Delay<F>
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.
sourcefn delay_local_at<F>(deadline: Instant, fut: F) -> Self::LocalDelay<F>where
F: Future,
fn delay_local_at<F>(deadline: Instant, fut: F) -> Self::LocalDelay<F>where
F: Future,
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§
sourcefn spawn<F>(
future: F
) -> <Self::Spawner as AsyncSpawner>::JoinHandle<<F as Future>::Output>
fn spawn<F>( future: F ) -> <Self::Spawner as AsyncSpawner>::JoinHandle<<F as Future>::Output>
Spawn a future onto the runtime
sourcefn spawn_detach<F>(future: F)
fn spawn_detach<F>(future: F)
Spawn a future onto the runtime and detach it
sourcefn spawn_local<F>(
future: F
) -> <Self::LocalSpawner as AsyncLocalSpawner>::JoinHandle<<F as Future>::Output>
fn spawn_local<F>( future: F ) -> <Self::LocalSpawner as AsyncLocalSpawner>::JoinHandle<<F as Future>::Output>
Spawn a future onto the local runtime
sourcefn spawn_local_detach<F>(future: F)
fn spawn_local_detach<F>(future: F)
Spawn a future onto the local runtime and detach it
sourcefn spawn_blocking<F, R>(
f: F
) -> <Self::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<R>
fn spawn_blocking<F, R>( f: F ) -> <Self::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<R>
Spawn a blocking function onto the runtime
sourcefn spawn_blocking_detach<F, R>(f: F)
fn spawn_blocking_detach<F, R>(f: F)
Spawn a blocking function onto the runtime and detach it
sourcefn spawn_after<F>(
duration: Duration,
future: F
) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<<F as Future>::Output>
fn spawn_after<F>( duration: Duration, future: F ) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<<F as Future>::Output>
Spawn a future onto the runtime and run the given future after the given duration
sourcefn spawn_after_at<F>(
at: Instant,
future: F
) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<<F as Future>::Output>
fn spawn_after_at<F>( at: Instant, future: F ) -> <Self::AfterSpawner as AsyncAfterSpawner>::JoinHandle<<F as Future>::Output>
Spawn a future onto the runtime and run the given future after the given instant.
sourcefn spawn_local_after<F>(
duration: Duration,
future: F
) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<<F as Future>::Output>
fn spawn_local_after<F>( duration: Duration, future: F ) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<<F as Future>::Output>
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
sourcefn spawn_local_after_at<F>(
at: Instant,
future: F
) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<<F as Future>::Output>
fn spawn_local_after_at<F>( at: Instant, future: F ) -> <Self::LocalAfterSpawner as AsyncLocalAfterSpawner>::JoinHandle<<F as Future>::Output>
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.
sourcefn timeout<F>(duration: Duration, future: F) -> Self::Timeout<F>
fn timeout<F>(duration: Duration, future: F) -> Self::Timeout<F>
Requires a Future to complete before the specified duration has elapsed.
The behavior of this function may different in different runtime implementations.
sourcefn timeout_at<F>(deadline: Instant, future: F) -> Self::Timeout<F>
fn timeout_at<F>(deadline: Instant, future: F) -> Self::Timeout<F>
Requires a Future to complete before the specified instant in time.
The behavior of this function may different in different runtime implementations.
sourcefn timeout_local<F>(duration: Duration, future: F) -> Self::LocalTimeout<F>where
F: Future,
fn timeout_local<F>(duration: Duration, future: F) -> Self::LocalTimeout<F>where
F: Future,
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.
sourcefn timeout_local_at<F>(deadline: Instant, future: F) -> Self::LocalTimeout<F>where
F: Future,
fn timeout_local_at<F>(deadline: Instant, future: F) -> Self::LocalTimeout<F>where
F: Future,
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.