lattice_simd/error.rs
1//! Errors returned by prepared quantized-tier operations.
2
3use crate::QuantizationTier;
4
5/// **Unstable**: error returned by a prepared quantized-tier operation.
6#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
7#[non_exhaustive]
8pub enum SimdError {
9 /// Internal logic error (count mismatch, unexpected state).
10 #[error("internal error: {0}")]
11 Internal(String),
12
13 /// A prepared SIMD operation received data at a different quantization tier.
14 /// See [`docs/simd.md`](../docs/simd.md#prepared-queries-and-tier-matching) for recovery and failure semantics.
15 #[error("tier mismatch in {op}: expected {expected:?}, got {actual:?}")]
16 TierMismatch {
17 /// Name of the operation where the mismatch was detected.
18 op: &'static str,
19 /// Tier the operation required.
20 expected: QuantizationTier,
21 /// Tier actually supplied.
22 actual: QuantizationTier,
23 },
24}
25
26/// **Unstable**: result type alias for prepared quantized-tier operations.
27pub type Result<T> = std::result::Result<T, SimdError>;