Skip to content

Commit

Permalink
Moved the get for the inner hash table of CryptoTable out
Browse files Browse the repository at this point in the history
to CryptoTable.
  • Loading branch information
Chris Bury committed Dec 6, 2023
1 parent 6039b90 commit 7507fae
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions procfs-core/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -60,6 +62,13 @@ impl FromBufRead for CryptoTable {
}
}

impl CryptoTable {
pub fn get<T: AsRef<str>>(&self, target: &T) -> Option<&CryptoBlock>
{
self.crypto_blocks.get(target.as_ref())
}
}

impl CryptoBlock {
fn from_iter<T: Iterator<Item = String>>(iter: &mut Peekable<T>, name: &str) -> ProcResult<Self> {
let driver = parse_line(iter, "driver", &name)?;
Expand Down

0 comments on commit 7507fae

Please sign in to comment.