inspiring 0.1.0-rc.3

InspiRING.Pack: a single-primitive ring-packing crate (eprint 2025/1352, Algorithm 1) on top of spiral-rs.
Documentation
//! Crate error type.
//!
//! Every fallible public API in `inspiring` returns `Result<_, InspiringError>`.
//! Variants are stable: adding a variant is a breaking change, removing or
//! renaming one is a breaking change.

use thiserror::Error;

/// All errors produced by the `inspiring` crate.
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum InspiringError {
    /// Parameter-set validation failure (see [`crate::params::RlweParams::new`]).
    ///
    /// Examples:
    /// - `d` is not a power of two.
    /// - `q` is even (would make `d^{-1} mod q` non-existent;
    ///   see SPEC.md §1).
    /// - `(z, ℓ)` are inconsistent with `q` (gadget cannot cover the
    ///   modulus, or `bits_per` derived from `(z, ℓ)` does not match
    ///   spiral-rs's `gadget::get_bits_per`; see
    ///   `docs/spiral-rs-mapping.md` §2).
    #[error("invalid parameter set: {0}")]
    InvalidParams(String),

    /// An LWE ciphertext (or batch) does not match the expected dimensions
    /// for the configured [`crate::params::RlweParams`].
    #[error("LWE shape mismatch: {0}")]
    LweShape(String),

    /// A [`crate::preprocess::PackPreprocessed`] was built against a
    /// different parameter set than the [`crate::lwe::LweBatch`] passed to
    /// [`crate::pack::pack`].
    #[error("preprocessing/parameter mismatch: {0}")]
    PreprocessMismatch(String),

    /// Internal invariant violation. Treat as a panic in debug builds; in
    /// release builds we surface it through `Result` so callers can decide.
    /// Always indicates a bug in `inspiring`, not in caller code.
    #[error("internal invariant: {0}")]
    Internal(&'static str),
}