From 7507faed9e41055c343295aed88689dbace2dd72 Mon Sep 17 00:00:00 2001 From: Chris Bury Date: Wed, 6 Dec 2023 17:33:23 +0000 Subject: [PATCH] Moved the get for the inner hash table of CryptoTable out to CryptoTable. --- procfs-core/src/crypto.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/procfs-core/src/crypto.rs b/procfs-core/src/crypto.rs index 74aafa1..90132ad 100644 --- a/procfs-core/src/crypto.rs +++ b/procfs-core/src/crypto.rs @@ -3,8 +3,10 @@ use crate::{expect, FromBufRead, ProcError, ProcResult}; #[cfg(feature = "serde1")] use serde::{Deserialize, Serialize}; use std::{ + borrow::Borrow, collections::HashMap, convert::TryFrom, + hash::Hash, io::BufRead, iter::{once, Peekable}, str::FromStr, @@ -60,6 +62,13 @@ impl FromBufRead for CryptoTable { } } +impl CryptoTable { + pub fn get>(&self, target: &T) -> Option<&CryptoBlock> + { + self.crypto_blocks.get(target.as_ref()) + } +} + impl CryptoBlock { fn from_iter>(iter: &mut Peekable, name: &str) -> ProcResult { let driver = parse_line(iter, "driver", &name)?;