pub struct AsyncScheduler<T> { /* private fields */ }Expand description
Async wrapper around Scheduler.
Implementations§
Source§impl<T> AsyncScheduler<T>
impl<T> AsyncScheduler<T>
Sourcepub fn new(inner: Arc<Scheduler<T>>) -> Self
pub fn new(inner: Arc<Scheduler<T>>) -> Self
Creates a new async wrapper over a shared core scheduler.
Sourcepub fn enqueue(&self, tenant: TenantKey, task: Task<T>) -> EnqueueResult
pub fn enqueue(&self, tenant: TenantKey, task: Task<T>) -> EnqueueResult
Enqueues a task.
Sourcepub fn enqueue_with_handle(
&self,
tenant: TenantKey,
task: Task<T>,
) -> EnqueueWithHandleResult
pub fn enqueue_with_handle( &self, tenant: TenantKey, task: Task<T>, ) -> EnqueueWithHandleResult
Enqueues a task and returns a cancellation handle.
Sourcepub fn try_dequeue(&self) -> DequeueResult<T>
pub fn try_dequeue(&self) -> DequeueResult<T>
Non-blocking dequeue attempt.
Sourcepub fn cancel(&self, handle: TaskHandle) -> CancelResult
pub fn cancel(&self, handle: TaskHandle) -> CancelResult
Attempts to cancel pending work by handle.
Sourcepub fn stats(&self) -> SchedulerStats
pub fn stats(&self) -> SchedulerStats
Returns scheduler metric snapshot.
Sourcepub fn close(&self)
pub fn close(&self)
Alias for AsyncScheduler::close_immediate.
Sourcepub fn close_immediate(&self)
pub fn close_immediate(&self)
Closes immediately.
Sourcepub fn close_drain(&self)
pub fn close_drain(&self)
Closes in drain mode.
Sourcepub fn close_with_mode(&self, mode: CloseMode)
pub fn close_with_mode(&self, mode: CloseMode)
Closes using a specific mode.
Sourcepub fn receiver(&self) -> AsyncReceiver<T>
pub fn receiver(&self) -> AsyncReceiver<T>
Returns a receiver-style async dequeue helper.
Sourcepub fn stream(&self) -> AsyncStream<T>
pub fn stream(&self) -> AsyncStream<T>
Returns a Stream wrapper for dequeue operations.
Source§impl<T: Send + 'static> AsyncScheduler<T>
impl<T: Send + 'static> AsyncScheduler<T>
Sourcepub async fn dequeue_async(&self) -> DequeueResult<T>
pub async fn dequeue_async(&self) -> DequeueResult<T>
Performs blocking dequeue on a Tokio blocking thread.
Sourcepub fn receiver_with_worker(&self, buffer: usize) -> AsyncWorkerReceiver<T>
pub fn receiver_with_worker(&self, buffer: usize) -> AsyncWorkerReceiver<T>
Returns a receiver powered by a dedicated dequeue worker thread.
Sourcepub fn stream_with_worker(&self, buffer: usize) -> AsyncWorkerReceiver<T>
pub fn stream_with_worker(&self, buffer: usize) -> AsyncWorkerReceiver<T>
Returns a stream powered by a dedicated dequeue worker thread.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for AsyncScheduler<T>
impl<T> !RefUnwindSafe for AsyncScheduler<T>
impl<T> Send for AsyncScheduler<T>where
T: Send,
impl<T> Sync for AsyncScheduler<T>where
T: Send,
impl<T> Unpin for AsyncScheduler<T>
impl<T> !UnwindSafe for AsyncScheduler<T>
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