passkey_types/ctap2/
flags.rs1use bitflags::bitflags;
2
3bitflags! {
4 #[repr(transparent)]
8 #[derive(Debug, PartialEq, Eq, Clone, Copy)]
9 pub struct Flags: u8 {
10 const UP = 1 << 0;
12 const UV = 1 << 2;
14 const BE = 1 << 3;
16 const BS = 1 << 4;
18 const AT = 1 << 6;
20 const ED = 1 << 7;
22 }
23}
24
25impl Default for Flags {
26 fn default() -> Self {
27 Flags::BE | Flags::BS
28 }
29}
30
31impl From<Flags> for u8 {
32 fn from(src: Flags) -> Self {
33 src.bits()
34 }
35}
36
37impl TryFrom<u8> for Flags {
38 type Error = ();
39
40 fn try_from(value: u8) -> Result<Self, Self::Error> {
41 Flags::from_bits(value).ok_or(())
42 }
43}