pub struct TaskQueue<T, O>{ /* private fields */ }
Expand description
任务队列结构
- queue: 任务发送通道
- queue_rx: 任务接收通道(包装在Arc
中以支持共享访问) - next_task_id: 下一个任务的ID(原子递增)
- stats: 任务处理器统计信息
Implementations§
Source§impl<T: Clone + Send + Sync + 'static, O: Clone + Send + Sync + 'static> TaskQueue<T, O>
impl<T: Clone + Send + Sync + 'static, O: Clone + Send + Sync + 'static> TaskQueue<T, O>
pub fn new(config: &ProcessorConfig) -> Self
pub async fn enqueue_task( &self, task: T, priority: u32, ) -> ForgeResult<(u64, Receiver<TaskResult<T, O>>)>
pub async fn get_next_ready( &self, ) -> Option<(T, u64, Sender<TaskResult<T, O>>, u32, u32)>
pub async fn get_stats(&self) -> ProcessorStats
pub async fn update_stats(&self, result: &TaskResult<T, O>)
Auto Trait Implementations§
impl<T, O> Freeze for TaskQueue<T, O>
impl<T, O> !RefUnwindSafe for TaskQueue<T, O>
impl<T, O> Send for TaskQueue<T, O>
impl<T, O> Sync for TaskQueue<T, O>
impl<T, O> Unpin for TaskQueue<T, O>
impl<T, O> !UnwindSafe for TaskQueue<T, O>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more