Skip to main content

create_executor

Function create_executor 

Source
pub fn create_executor(mode: ConcurrencyMode) -> Executor
Expand description

Create executor instance based on mode and available features.

Automatically falls back to Sequential when requested mode unavailable.

§Arguments

  • mode - Desired concurrency mode

§Returns

Executor enum instance ready for use.

§Examples

use thread_flow::incremental::concurrency::{
    create_executor, ConcurrencyMode,
};

// Request Rayon (falls back to Sequential if `parallel` feature disabled)
let executor = create_executor(ConcurrencyMode::Rayon { num_threads: Some(4) });

// Tokio always available
let executor = create_executor(ConcurrencyMode::Tokio { max_concurrent: 10 });