pub struct TaskScheduler { /* private fields */ }Expand description
Lightweight wrapper around tokio::spawn that enforces per-agent concurrency.
Implementations§
Source§impl TaskScheduler
impl TaskScheduler
Sourcepub fn new(config: SchedulerConfig) -> Self
pub fn new(config: SchedulerConfig) -> Self
Constructs a scheduler using the provided configuration.
Sourcepub const fn config(&self) -> SchedulerConfig
pub const fn config(&self) -> SchedulerConfig
Returns the associated configuration.
Sourcepub fn spawn<F, T>(&self, future: F) -> SchedulerResult<JoinHandle<T>>
pub fn spawn<F, T>(&self, future: F) -> SchedulerResult<JoinHandle<T>>
Spawns a future, respecting the configured concurrency limit.
§Errors
Returns SchedulerError::Closed when the scheduler is closed before the
task is enqueued.
§Panics
Panics if the scheduler is closed while a task is awaiting a concurrency
permit. This indicates that close was invoked concurrently with task
submission.
Trait Implementations§
Source§impl Clone for TaskScheduler
impl Clone for TaskScheduler
Source§fn clone(&self) -> TaskScheduler
fn clone(&self) -> TaskScheduler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TaskScheduler
impl Debug for TaskScheduler
Auto Trait Implementations§
impl Freeze for TaskScheduler
impl RefUnwindSafe for TaskScheduler
impl Send for TaskScheduler
impl Sync for TaskScheduler
impl Unpin for TaskScheduler
impl UnwindSafe for TaskScheduler
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