Skip to main content

NoTimerQueue

Struct NoTimerQueue 

pub struct NoTimerQueue<I>(/* private fields */);
Expand description

选择省略定时任务队列(timer task queue)。类型参数与执行器(executor)的时钟(clock)时刻匹配。 普通定时派发(timed task dispatch)要求真实的定时来源。

ⓘ
use pi_async_executor::{routing::LocalReadySubmit, ExecutorHandle, NoIdleQueue, NoTimerQueue};
use pi_async_runtime_core::TaskConfig;
use pi_async_task_queue::MpscTaskQueueHandle;
use std::time::Duration;
fn unavailable<L: LocalReadySubmit>(handle: &ExecutorHandle<MpscTaskQueueHandle, NoIdleQueue, NoTimerQueue<()>, L>) {
    handle.spawn_timing(async {}, Duration::ZERO, TaskConfig::<()>::default());
}

本地定时派发也要求真实的定时来源。

ⓘ
use pi_async_executor::{routing::LocalReadySubmit, ExecutorHandle, ExecutorLocal, NoIdleQueue, NoTimerQueue};
use pi_async_runtime_core::TaskConfig;
use pi_async_task_queue::MpscTaskQueueHandle;
use std::time::Duration;
fn unavailable<L: LocalReadySubmit>(handle: &ExecutorHandle<MpscTaskQueueHandle, NoIdleQueue, NoTimerQueue<()>, L>, local: &ExecutorLocal<NoTimerQueue<()>>) {
    handle.spawn_timing_local(local, async {}, Duration::ZERO, TaskConfig::<()>::default());
}
ⓘ
use pi_async_executor::{ExecutorLocal, NoTimerQueue};
fn unavailable(local: &ExecutorLocal<NoTimerQueue<()>>) {
    local.try_push_timer((), ());
}

Trait Implementations§

§

impl<I> Default for NoTimerQueue<I>

§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<I> Forget for NoTimerQueue<I>

§

impl<I> Freeze for NoTimerQueue<I>
where PhantomData<fn() -> I>: Freeze,

§

impl<I> Move for NoTimerQueue<I>

§

impl<I> RefUnwindSafe for NoTimerQueue<I>
where PhantomData<fn() -> I>: RefUnwindSafe,

§

impl<I> Send for NoTimerQueue<I>
where PhantomData<fn() -> I>: Send,

§

impl<I> Sync for NoTimerQueue<I>
where PhantomData<fn() -> I>: Sync,

§

impl<I> Unpin for NoTimerQueue<I>
where PhantomData<fn() -> I>: Unpin,

§

impl<I> UnsafeUnpin for NoTimerQueue<I>
where PhantomData<fn() -> I>: UnsafeUnpin,

§

impl<I> UnwindSafe for NoTimerQueue<I>
where PhantomData<fn() -> I>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OpaqueAttachment for T
where T: Send + Sync + 'static,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.