alphanumeric_stepper/
errors.rs1use core::fmt::{self, Display, Formatter};
2#[cfg(feature = "std")]
3use std::error::Error;
4
5#[derive(Debug, Clone)]
6pub enum AlphanumericStepperBuildError {
7 InvalidWidth,
8}
9
10impl Display for AlphanumericStepperBuildError {
11 #[inline]
12 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
13 match self {
14 Self::InvalidWidth => f.write_str("invalid width"),
15 }
16 }
17}
18
19#[cfg(feature = "std")]
20impl Error for AlphanumericStepperBuildError {}
21
22#[derive(Debug, Clone)]
23pub enum AlphanumericStepperEncodeError {
24 NumberOutOfRange,
25}
26
27impl Display for AlphanumericStepperEncodeError {
28 #[inline]
29 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
30 match self {
31 Self::NumberOutOfRange => f.write_str("number out of range"),
32 }
33 }
34}
35
36#[cfg(feature = "std")]
37impl Error for AlphanumericStepperEncodeError {}
38
39#[derive(Debug, Clone)]
40pub enum AlphanumericStepperDecodeError {
41 InvalidLength,
42 InvalidCharacter,
43}
44
45impl Display for AlphanumericStepperDecodeError {
46 #[inline]
47 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
48 match self {
49 Self::InvalidLength => f.write_str("invalid length"),
50 Self::InvalidCharacter => f.write_str("invalid character"),
51 }
52 }
53}
54
55#[cfg(feature = "std")]
56impl Error for AlphanumericStepperDecodeError {}