From e9caedb7419e80c4734db1259054cf629df6a066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Tue, 22 Aug 2023 16:44:50 +0200 Subject: [PATCH] Make PinId methods public --- src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 28628ad..912a34b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,7 +110,10 @@ const BACKEND_DIR: &str = "backend-auth"; pub struct PinId(u8); impl PinId { - fn path(&self) -> PathBuf { + /// Get the path to the PIN id. + /// + /// Path are of the form `pin.XX` where `xx` is the hexadecimal representation of the PIN number. + pub fn path(&self) -> PathBuf { let mut path = [0; 6]; path[0..4].copy_from_slice(b"pin."); path[4..].copy_from_slice(&self.hex()); @@ -118,7 +121,8 @@ impl PinId { PathBuf::from(&path) } - fn hex(&self) -> [u8; 2] { + /// Get the hex representation of the PIN id + pub fn hex(&self) -> [u8; 2] { const CHARS: &[u8; 16] = b"0123456789abcdef"; [ CHARS[usize::from(self.0 >> 4)],