Skip to main content

IdleDispatch

Trait IdleDispatch 

pub trait IdleDispatch: TaskDispatch {
    // Required methods
    fn submit_idle(&self, task: UnsubmittedTask) -> RawResult<(), SubmitError>;
    fn idle_local_with_config<F, M>(
        future: F,
        config: TaskConfig<M>,
    ) -> RawResult<TaskHandle<Self::Notifier, F::Output, M>, SpawnError<F, Self::Notifier, M>>
       where F: Future + Send + 'static,
             F::Output: Send + 'static,
             M: Send + Sync + 'static;

    // Provided methods
    fn idle_with_config<F, M>(
        &self,
        future: F,
        config: TaskConfig<M>,
    ) -> RawResult<TaskHandle<Self::Notifier, F::Output, M>, SpawnError<F, Self::Notifier, M>>
       where F: Future + Send + 'static,
             F::Output: Send + 'static,
             M: Send + Sync + 'static { ... }
    fn idle<F>(
        &self,
        future: F,
    ) -> RawResult<TaskHandle<Self::Notifier, F::Output>, SpawnError<F, Self::Notifier>>
       where F: Future + Send + 'static,
             F::Output: Send + 'static { ... }
    fn idle_local<F>(
        future: F,
    ) -> RawResult<TaskHandle<Self::Notifier, F::Output>, SpawnError<F, Self::Notifier>>
       where F: Future + Send + 'static,
             F::Output: Send + 'static { ... }
}
Expand description

空闲来源不判断是否空闲;提交成功不承诺一定被接纳或执行。

Required Methods§

fn submit_idle(&self, task: UnsubmittedTask) -> RawResult<(), SubmitError>

向同一服务的空闲来源提交普通Send任务(Task);不检查空闲、不保证未来接纳。

fn idle_local_with_config<F, M>( future: F, config: TaskConfig<M>, ) -> RawResult<TaskHandle<Self::Notifier, F::Output, M>, SpawnError<F, Self::Notifier, M>>
where F: Future + Send + 'static, F::Output: Send + 'static, M: Send + Sync + 'static,

从当前环境定位原服务后提交共享空闲来源;Future与输出要求Send,不要求Sync,不预先绑定执行线程。

Provided Methods§

fn idle_with_config<F, M>( &self, future: F, config: TaskConfig<M>, ) -> RawResult<TaskHandle<Self::Notifier, F::Output, M>, SpawnError<F, Self::Notifier, M>>
where F: Future + Send + 'static, F::Output: Send + 'static, M: Send + Sync + 'static,

创建并提交空闲时任务(idle task);成功只证明来源接受,不保证执行。

fn idle<F>( &self, future: F, ) -> RawResult<TaskHandle<Self::Notifier, F::Output>, SpawnError<F, Self::Notifier>>
where F: Future + Send + 'static, F::Output: Send + 'static,

默认配置的空闲提交;任务(Task)未接纳前仍可按原控制能力取消。

fn idle_local<F>( future: F, ) -> RawResult<TaskHandle<Self::Notifier, F::Output>, SpawnError<F, Self::Notifier>>
where F: Future + Send + 'static, F::Output: Send + 'static,

默认配置的当前空闲提交;输入保持Send约束,不等同spawn_local的本地非Send能力。

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§