Skip to content

Commit

Permalink
rust: Chain key finding calls
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Aug 21, 2024
1 parent 6c7c470 commit 5ca8848
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/dekoder/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ impl<K: Eq + for<'a> TryFrom<&'a Yaml, Error = EKOError>> Inventory<K> {
/// Load `k` from disk.
pub fn load(&self, k: &K, v: &mut Operator) -> Result<()> {
// Find key
let k = self.keys.iter().find(|it| (it.1).eq(k));
let k = k.ok_or(EKOError::KeyError("because it was not found".to_owned()))?;
let k = self
.keys
.iter()
.find(|it| (it.1).eq(k))
.ok_or(EKOError::KeyError("because it was not found".to_owned()))?;
let p = self.path.join(k.0).with_extension("npz.lz4");
// Read npz.lz4
let mut reader = BufReader::new(FrameDecoder::new(BufReader::new(File::open(&p)?)));
Expand Down

0 comments on commit 5ca8848

Please sign in to comment.