rust_qrng 0.1.2

Tsotchkes quantum random number generator library with cryptographic, financial, and gaming applications converted to Rust
Documentation
// This file defines custom error types and error handling mechanisms for the core functionalities of the library.

use std::fmt;

#[derive(Debug)]
pub enum QuantumRngError {
    InitializationError(String),
    GenerationError(String),
    InvalidLength,
    Other(String),
}

impl fmt::Display for QuantumRngError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            QuantumRngError::InitializationError(msg) => write!(f, "Initialization Error: {}", msg),
            QuantumRngError::GenerationError(msg) => write!(f, "Generation Error: {}", msg),
            QuantumRngError::InvalidLength => write!(f, "Invalid length error"),
            QuantumRngError::Other(msg) => write!(f, "Error: {}", msg),
        }
    }
}

impl std::error::Error for QuantumRngError {}

pub type Result<T> = std::result::Result<T, QuantumRngError>;