Skip to main content

TaskBatch

Struct TaskBatch 

pub struct TaskBatch { /* private fields */ }
Expand description

持有按获取顺序排列的一批唯一Runnable;不复制任务(Task)。

Implementations§

§

impl TaskBatch

pub fn from_tasks(tasks: VecDeque<Runnable>) -> Self

接管已有序列,不排序、不轮询(poll),不新增每任务节点分配。

§

impl TaskBatch

pub fn len(&self) -> usize

取得本批当前任务数,O(1),不访问外部队列。

§

impl TaskBatch

pub fn is_empty(&self) -> bool

判断本批是否为空,不代表运行时(runtime)无任务。

Trait Implementations§

§

impl IntoIterator for TaskBatch

§

fn into_iter(self) -> Self::IntoIter

按原顺序转交每份Runnable,未消费部分随迭代器释放并承担正常退出。

§

type Item = Runnable

The type of the elements being iterated over.
§

type IntoIter = IntoIter<Runnable>

Which kind of iterator are we turning this into?

Auto Trait Implementations§

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.