qubit_batch/execute/impls/parallel_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 building a [`crate::ParallelBatchExecutor`].
13///
14/// ```rust
15/// use qubit_batch::{
16/// ParallelBatchExecutor,
17/// ParallelBatchExecutorBuildError,
18/// };
19///
20/// let error = match ParallelBatchExecutor::builder().thread_count(0).build() {
21/// Ok(_) => panic!("zero worker count should be rejected"),
22/// Err(error) => error,
23/// };
24///
25/// assert_eq!(error, ParallelBatchExecutorBuildError::ZeroThreadCount);
26/// ```
27#[derive(Debug, Clone, Copy, PartialEq, Eq, Error)]
28pub enum ParallelBatchExecutorBuildError {
29 /// The configured worker-thread count is zero.
30 #[error("parallel batch executor thread count must be positive")]
31 ZeroThreadCount,
32}