1#![cfg_attr(not(feature = "std"), no_std)]
4
5pub mod registry;
6pub mod traits;
7pub mod types;
8pub mod validate;
9
10pub use types::{Error, Result};
12
13pub use registry::ERROR_REGISTRY;
15
16pub use traits::{ResultExt, SecureErrorHandling};
18
19pub use validate as validation;
21
22#[cfg(feature = "std")]
24impl From<std::array::TryFromSliceError> for Error {
25 fn from(_: std::array::TryFromSliceError) -> Self {
26 Self::InvalidLength {
27 context: "array conversion",
28 expected: 0, actual: 0, }
31 }
32}
33
34#[cfg(feature = "std")]
35impl From<std::io::Error> for Error {
36 fn from(e: std::io::Error) -> Self {
37 Self::Other {
38 context: "I/O operation",
39 message: e.to_string(),
40 }
41 }
42}
43
44#[cfg(feature = "std")]
45use std::error::Error as StdError;
46
47#[cfg(feature = "std")]
49impl StdError for Error {}
50
51pub type CipherResult<T> = Result<T>;
53pub type HashResult<T> = Result<T>;
54pub type KeyResult<T> = Result<T>;
55pub type SignatureResult<T> = Result<T>;