Skip to main content

TimedTaskDispatch

Trait TimedTaskDispatch 

pub trait TimedTaskDispatch: TaskDispatch + RuntimeTime {
    // Required methods
    fn spawn_timing_with_config<F, M>(
        &self,
        future: F,
        delay: Duration,
        config: TaskConfig<M>,
    ) -> Result<TaskHandle<TimedTaskNotifier<Self::Notifier, Self::Timer>, <F as Future>::Output, M>, SpawnError<F, TimedTaskNotifier<Self::Notifier, Self::Timer>, M>>
       where F: Future + Send + 'static,
             <F as Future>::Output: Send + 'static,
             M: Send + Sync + 'static;
    fn spawn_timing_local_with_config<F, M>(
        future: F,
        delay: Duration,
        config: TaskConfig<M>,
    ) -> Result<TaskHandle<TimedTaskNotifier<Self::Notifier, Self::Timer>, <F as Future>::Output, M, LocalOutput>, SpawnError<F, TimedTaskNotifier<Self::Notifier, Self::Timer>, M, LocalOutput>>
       where F: Future + 'static,
             <F as Future>::Output: 'static,
             M: Send + Sync + 'static;

    // Provided methods
    fn spawn_timing<F>(
        &self,
        future: F,
        delay: Duration,
    ) -> Result<TaskHandle<TimedTaskNotifier<Self::Notifier, Self::Timer>, <F as Future>::Output>, SpawnError<F, TimedTaskNotifier<Self::Notifier, Self::Timer>>>
       where F: Future + Send + 'static,
             <F as Future>::Output: Send + 'static { ... }
    fn spawn_timing_local<F>(
        future: F,
        delay: Duration,
    ) -> Result<TaskHandle<TimedTaskNotifier<Self::Notifier, Self::Timer>, <F as Future>::Output, (), LocalOutput>, SpawnError<F, TimedTaskNotifier<Self::Notifier, Self::Timer>, (), LocalOutput>>
       where F: Future + 'static,
             <F as Future>::Output: 'static { ... }
}
Expand description

同步提交原业务任务(Task)到定时来源;不直接poll,不经普通来源绕行。

Required Methods§

Source

fn spawn_timing_with_config<F, M>( &self, future: F, delay: Duration, config: TaskConfig<M>, ) -> Result<TaskHandle<TimedTaskNotifier<Self::Notifier, Self::Timer>, <F as Future>::Output, M>, SpawnError<F, TimedTaskNotifier<Self::Notifier, Self::Timer>, M>>
where F: Future + Send + 'static, <F as Future>::Output: Send + 'static, M: Send + Sync + 'static,

同步固定本次截止时间并提交定时来源;准备失败保原Future,明确拒绝保原任务(Task)和结果句柄(handle)。

Source

fn spawn_timing_local_with_config<F, M>( future: F, delay: Duration, config: TaskConfig<M>, ) -> Result<TaskHandle<TimedTaskNotifier<Self::Notifier, Self::Timer>, <F as Future>::Output, M, LocalOutput>, SpawnError<F, TimedTaskNotifier<Self::Notifier, Self::Timer>, M, LocalOutput>>
where F: Future + 'static, <F as Future>::Output: 'static, M: Send + Sync + 'static,

当前原线程内同步定时派发(timed dispatch);原Future/输出不要求Send/Sync,准备和拒绝均保留原值。

Provided Methods§

Source

fn spawn_timing<F>( &self, future: F, delay: Duration, ) -> Result<TaskHandle<TimedTaskNotifier<Self::Notifier, Self::Timer>, <F as Future>::Output>, SpawnError<F, TimedTaskNotifier<Self::Notifier, Self::Timer>>>
where F: Future + Send + 'static, <F as Future>::Output: Send + 'static,

默认配置的同步定时派发(timed dispatch);零时长仍入定时来源,不直接执行。

Source

fn spawn_timing_local<F>( future: F, delay: Duration, ) -> Result<TaskHandle<TimedTaskNotifier<Self::Notifier, Self::Timer>, <F as Future>::Output, (), LocalOutput>, SpawnError<F, TimedTaskNotifier<Self::Notifier, Self::Timer>, (), LocalOutput>>
where F: Future + 'static, <F as Future>::Output: 'static,

默认配置的本地定时派发(timed dispatch);不跳过原所属域或定时来源。

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

§

impl<C, E, I, T> TimedTaskDispatch for RuntimeHandle<C, E, I, T>

§

impl<M, C, P, H, E, I, T> TimedTaskDispatch for ConfiguredRuntime<M, C, P, H, E, I, T>