From 0b8c0a61958b40993d3ff40c5076c0aceac2bfd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sun, 26 Mar 2023 20:33:43 +0200 Subject: [PATCH] Add a display method to the Algorithm struct --- src/algorithm.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/algorithm.rs b/src/algorithm.rs index 61924ba..053c853 100644 --- a/src/algorithm.rs +++ b/src/algorithm.rs @@ -8,6 +8,17 @@ pub enum Algorithm { Rsa4096Sha256, } +impl Algorithm { + pub fn display(&self) -> String { + match self { + Self::Ed25519Sha256 => String::from("ed25519-sha256"), + Self::Rsa2048Sha256 | Self::Rsa3072Sha256 | Self::Rsa4096Sha256 => { + String::from("rsa-sha256") + } + } + } +} + impl Default for Algorithm { fn default() -> Self { Self::Rsa2048Sha256