pub struct YastlPool(/* private fields */);Expand description
A wrapper for yastl::Pool and number of threads it was built with.
NOTE: The reason why yastl::Pool does not directly implement ParThreadPool
is simply to be able to provide max_num_threads which is the argument used
to create the pool with.
Two constructors of the yastl::Pool are made available to YastlPool:
Implementations§
Source§impl YastlPool
impl YastlPool
Sourcepub fn new(num_threads: usize) -> Self
pub fn new(num_threads: usize) -> Self
Create a new Pool that will execute it’s tasks on num_threads worker threads.
Sourcepub fn with_config(num_threads: usize, config: ThreadConfig) -> Self
pub fn with_config(num_threads: usize, config: ThreadConfig) -> Self
Create a new Pool that will execute it’s tasks on num_threads worker threads and
spawn them using the given config.
Sourcepub fn into_inner(self) -> Pool
pub fn into_inner(self) -> Pool
Returns the wrapped yastl::Pool.
Trait Implementations§
Source§impl ParThreadPool for &YastlPool
impl ParThreadPool for &YastlPool
Source§type ScopeRef<'s, 'env, 'scope> = &'s Scope<'scope>
where
'scope: 's,
'env: 'scope + 's
type ScopeRef<'s, 'env, 'scope> = &'s Scope<'scope> where 'scope: 's, 'env: 'scope + 's
Scope type of the thread pool.
Source§fn run_in_scope<'s, 'env, 'scope, W>(
s: &Self::ScopeRef<'s, 'env, 'scope>,
work: W,
)
fn run_in_scope<'s, 'env, 'scope, W>( s: &Self::ScopeRef<'s, 'env, 'scope>, work: W, )
Executes the
work within scope s.Source§fn scoped_computation<'env, 'scope, F>(&'env mut self, f: F)
fn scoped_computation<'env, 'scope, F>(&'env mut self, f: F)
Executes the scoped computation
f.Source§fn max_num_threads(&self) -> NonZeroUsize
fn max_num_threads(&self) -> NonZeroUsize
Returns the maximum number of threads available in the pool.
Source§impl ParThreadPool for YastlPool
impl ParThreadPool for YastlPool
Source§type ScopeRef<'s, 'env, 'scope> = &'s Scope<'scope>
where
'scope: 's,
'env: 'scope + 's
type ScopeRef<'s, 'env, 'scope> = &'s Scope<'scope> where 'scope: 's, 'env: 'scope + 's
Scope type of the thread pool.
Source§fn run_in_scope<'s, 'env, 'scope, W>(
s: &Self::ScopeRef<'s, 'env, 'scope>,
work: W,
)
fn run_in_scope<'s, 'env, 'scope, W>( s: &Self::ScopeRef<'s, 'env, 'scope>, work: W, )
Executes the
work within scope s.Source§fn scoped_computation<'env, 'scope, F>(&'env mut self, f: F)
fn scoped_computation<'env, 'scope, F>(&'env mut self, f: F)
Executes the scoped computation
f.Source§fn max_num_threads(&self) -> NonZeroUsize
fn max_num_threads(&self) -> NonZeroUsize
Returns the maximum number of threads available in the pool.
Auto Trait Implementations§
impl Freeze for YastlPool
impl RefUnwindSafe for YastlPool
impl Send for YastlPool
impl Sync for YastlPool
impl Unpin for YastlPool
impl UnwindSafe for YastlPool
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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