pub enum ExecutionContext {
Parallel(ParallelContext),
Async(AsyncContext),
Hybrid(HybridContext),
}Expand description
Concrete execution context enum that wraps different strategy implementations This approach ensures type safety while avoiding dyn-compatibility issues
Variants§
Parallel(ParallelContext)
Parallel execution for CPU-bound work
Async(AsyncContext)
Async execution for I/O-bound work
Hybrid(HybridContext)
Hybrid execution that adapts between strategies
Implementations§
Source§impl ExecutionContext
impl ExecutionContext
Sourcepub fn execute<F, R>(&self, func: F) -> Result<R, Box<dyn Error + Sync + Send>>
pub fn execute<F, R>(&self, func: F) -> Result<R, Box<dyn Error + Sync + Send>>
Execute a function once with the appropriate context
Sourcepub fn execute_iter<T, F, R>(
&self,
items: Vec<T>,
func: F,
) -> Result<Vec<R>, Box<dyn Error + Sync + Send>>
pub fn execute_iter<T, F, R>( &self, items: Vec<T>, func: F, ) -> Result<Vec<R>, Box<dyn Error + Sync + Send>>
Execute an iterator operation with proper type erasure
Sourcepub async fn execute_async_iter<T, F, Fut, R>(
&self,
items: Vec<T>,
func: F,
) -> Result<Vec<R>, Box<dyn Error + Sync + Send>>
pub async fn execute_async_iter<T, F, Fut, R>( &self, items: Vec<T>, func: F, ) -> Result<Vec<R>, Box<dyn Error + Sync + Send>>
Execute async iterator operations
Sourcepub async fn execute_async_filter<T, F, Fut>(
&self,
items: Vec<T>,
predicate: F,
) -> Result<Vec<T>, Box<dyn Error + Sync + Send>>
pub async fn execute_async_filter<T, F, Fut>( &self, items: Vec<T>, predicate: F, ) -> Result<Vec<T>, Box<dyn Error + Sync + Send>>
Execute async filter operations
Sourcepub async fn execute_async_for_each<T, F, Fut>(
&self,
items: Vec<T>,
func: F,
) -> Result<(), Box<dyn Error + Sync + Send>>
pub async fn execute_async_for_each<T, F, Fut>( &self, items: Vec<T>, func: F, ) -> Result<(), Box<dyn Error + Sync + Send>>
Execute async for_each operations
Sourcepub async fn execute_reduce<T, F>(
&self,
items: Vec<T>,
func: F,
) -> Result<Option<T>, Box<dyn Error + Sync + Send>>
pub async fn execute_reduce<T, F>( &self, items: Vec<T>, func: F, ) -> Result<Option<T>, Box<dyn Error + Sync + Send>>
Execute parallel reduce operations
Sourcepub fn context_type(&self) -> &'static str
pub fn context_type(&self) -> &'static str
Get context type name
Trait Implementations§
Source§impl Clone for ExecutionContext
impl Clone for ExecutionContext
Source§fn clone(&self) -> ExecutionContext
fn clone(&self) -> ExecutionContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExecutionContext
impl RefUnwindSafe for ExecutionContext
impl Send for ExecutionContext
impl Sync for ExecutionContext
impl Unpin for ExecutionContext
impl UnsafeUnpin for ExecutionContext
impl UnwindSafe for ExecutionContext
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