Skip to main content

qubit_rayon_batch/
rayon_batch_executor_build_error.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2025 - 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10use thiserror::Error;
11
12/// Error returned when [`crate::RayonBatchExecutorBuilder`] cannot build an
13/// executor.
14///
15#[derive(Debug, Error)]
16pub enum RayonBatchExecutorBuildError {
17    /// The configured Rayon thread count is zero.
18    #[error("rayon batch executor thread count must be greater than zero")]
19    ZeroThreadCount,
20
21    /// The configured worker stack size is zero.
22    #[error("rayon batch executor worker stack size must be greater than zero")]
23    ZeroStackSize,
24
25    /// Rayon rejected the underlying thread-pool configuration.
26    #[error("failed to build rayon batch executor: {source}")]
27    BuildFailed {
28        /// Underlying Rayon thread-pool build error.
29        #[from]
30        source: rayon::ThreadPoolBuildError,
31    },
32}