pub struct RayonCpuDomainExecutor { /* private fields */ }Expand description
Adapter that executes CPU-domain jobs on one caller-owned Rayon pool.
The adapter retains the supplied pool and never creates, reconfigures, or
shuts it down. CpuDomainExecutor remains the primary injection contract;
this type is only a convenience for Rayon hosts.
§Examples
use std::sync::Arc;
use tenferro_cpu::{CpuDomainExecutor, RayonCpuDomainExecutor};
let pool = Arc::new(rayon::ThreadPoolBuilder::new().num_threads(2).build()?);
let executor = RayonCpuDomainExecutor::new(Arc::clone(&pool));
assert_eq!(executor.capabilities().worker_count.get(), 2);
assert_eq!(Arc::strong_count(&pool), 2);Implementations§
Source§impl RayonCpuDomainExecutor
impl RayonCpuDomainExecutor
Sourcepub fn new(pool: Arc<ThreadPool>) -> Self
pub fn new(pool: Arc<ThreadPool>) -> Self
Retain one caller-owned Rayon pool as a CPU-domain executor.
§Examples
use std::sync::Arc;
use tenferro_cpu::{CpuDomainExecutor, RayonCpuDomainExecutor};
let pool = Arc::new(rayon::ThreadPoolBuilder::new().num_threads(2).build()?);
let executor = RayonCpuDomainExecutor::new(pool);
assert_eq!(executor.capabilities().worker_count.get(), 2);Trait Implementations§
Source§impl CpuDomainExecutor for RayonCpuDomainExecutor
impl CpuDomainExecutor for RayonCpuDomainExecutor
Source§fn capabilities(&self) -> CpuDomainExecutorCapabilities
fn capabilities(&self) -> CpuDomainExecutorCapabilities
Return immutable construction-time executor capabilities. Read more
Source§fn submit(&self, jobs: &dyn ScopedCpuJobs) -> Result<(), CpuDomainExecutorError>
fn submit(&self, jobs: &dyn ScopedCpuJobs) -> Result<(), CpuDomainExecutorError>
Submit all indexed jobs as one synchronous fork/join operation. Read more
Source§fn install(
&self,
job: &mut dyn ScopedCpuJob,
) -> Result<(), CpuDomainExecutorError>
fn install( &self, job: &mut dyn ScopedCpuJob, ) -> Result<(), CpuDomainExecutorError>
Enter one synchronous provider-owned inner parallel region. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for RayonCpuDomainExecutor
impl !UnwindSafe for RayonCpuDomainExecutor
impl Freeze for RayonCpuDomainExecutor
impl Send for RayonCpuDomainExecutor
impl Sync for RayonCpuDomainExecutor
impl Unpin for RayonCpuDomainExecutor
impl UnsafeUnpin for RayonCpuDomainExecutor
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
impl<T, U> Imply<T> for U
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