1use core::fmt;
4
5#[derive(Clone, Copy, PartialEq, Eq)]
11#[repr(u8)]
12pub enum AuthError {
13 E1 = 1,
14 E2 = 2,
15 E3 = 3,
16 E4 = 4,
17 E5 = 5,
18}
19
20impl fmt::Display for AuthError {
21 #[inline(always)]
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 let c = [b'E', b'0' + (*self as u8)];
25 f.write_str(unsafe { core::str::from_utf8_unchecked(&c) })
26 }
27}
28
29impl fmt::Debug for AuthError {
30 #[inline(always)]
31 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32 fmt::Display::fmt(self, f)
33 }
34}
35
36pub type Result<T> = core::result::Result<T, AuthError>;