#![cfg_attr(not(feature = "std"), no_std)]
pub mod registry;
pub mod traits;
pub mod types;
pub mod validate;
pub use types::{Error, Result};
pub use registry::ERROR_REGISTRY;
pub use traits::{ResultExt, SecureErrorHandling};
pub use validate as validation;
#[cfg(feature = "std")]
impl From<std::array::TryFromSliceError> for Error {
fn from(_: std::array::TryFromSliceError) -> Self {
Self::InvalidLength {
context: "array conversion",
expected: 0, actual: 0, }
}
}
#[cfg(feature = "std")]
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Self::Other {
context: "I/O operation",
message: e.to_string(),
}
}
}
#[cfg(feature = "std")]
use std::error::Error as StdError;
#[cfg(feature = "std")]
impl StdError for Error {}
pub type CipherResult<T> = Result<T>;
pub type HashResult<T> = Result<T>;
pub type KeyResult<T> = Result<T>;
pub type SignatureResult<T> = Result<T>;