base32ct/error.rs
1//! Error types.
2
3use core::fmt;
4
5/// Result type with the `base32ct` crate's [`Error`] type.
6pub type Result<T> = core::result::Result<T, Error>;
7
8/// Error type
9#[derive(Clone, Eq, PartialEq, Debug)]
10pub enum Error {
11 /// Invalid encoding of provided Base32 string.
12 InvalidEncoding,
13
14 /// Insufficient output buffer length.
15 InvalidLength,
16}
17
18impl fmt::Display for Error {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 Error::InvalidEncoding => f.write_str("invalid Base32 encoding"),
22 Error::InvalidLength => f.write_str("invalid Base32 length"),
23 }
24 }
25}
26
27impl core::error::Error for Error {}