pub enum Scheduler<HostType: Host> {
ThreadPerHost(ThreadPerHostSched<HostType>),
ThreadPerCore(ThreadPerCoreSched<HostType>),
}
Expand description
A wrapper for different host schedulers. It would have been nice to make this a trait, but would require support for GATs.
Variants§
ThreadPerHost(ThreadPerHostSched<HostType>)
ThreadPerCore(ThreadPerCoreSched<HostType>)
Implementations§
source§impl<HostType: Host> Scheduler<HostType>
impl<HostType: Host> Scheduler<HostType>
sourcepub fn parallelism(&self) -> usize
pub fn parallelism(&self) -> usize
The maximum number of threads that will ever be run in parallel. The number of threads created by the scheduler may be higher.
sourcepub fn scope<'scope>(
&'scope mut self,
f: impl for<'a, 'b> FnOnce(SchedulerScope<'a, 'b, 'scope, HostType>) + 'scope,
)
pub fn scope<'scope>( &'scope mut self, f: impl for<'a, 'b> FnOnce(SchedulerScope<'a, 'b, 'scope, HostType>) + 'scope, )
Create a scope for any task run on the scheduler. The current thread will block at the end of the scope until the task has completed.
Auto Trait Implementations§
impl<HostType> Freeze for Scheduler<HostType>
impl<HostType> !RefUnwindSafe for Scheduler<HostType>
impl<HostType> Send for Scheduler<HostType>
impl<HostType> Sync for Scheduler<HostType>
impl<HostType> Unpin for Scheduler<HostType>
impl<HostType> !UnwindSafe for Scheduler<HostType>
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