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