From 47e3b82d0f8c9c4abcaf8588764fa934446dbdc8 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 5 May 2024 14:02:09 +0200 Subject: feat(pkgs/lf-make-map): Change the key to custom type and add visuals --- sys/nixpkgs/pkgs/lf-make-map/src/generator/mod.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'sys/nixpkgs/pkgs/lf-make-map/src/generator/mod.rs') diff --git a/sys/nixpkgs/pkgs/lf-make-map/src/generator/mod.rs b/sys/nixpkgs/pkgs/lf-make-map/src/generator/mod.rs index 48df027f..c03b33dc 100644 --- a/sys/nixpkgs/pkgs/lf-make-map/src/generator/mod.rs +++ b/sys/nixpkgs/pkgs/lf-make-map/src/generator/mod.rs @@ -1,10 +1,10 @@ use std::path::PathBuf; use anyhow::{Context, Result}; -use log::{debug, info, trace}; +use log::trace; use walkdir::{DirEntry, WalkDir}; -use crate::mapping::{map_tree::MappingTree, Mapping}; +use crate::mapping::{map_tree::MappingTree, MapKey, Mapping}; pub struct MappingsGenerator { mappings: MappingTree, @@ -35,9 +35,15 @@ impl MappingsGenerator { trace!("Processed '{}'..", directory.path().display()); let mapping = Mapping::new(&home_path, directory.path().to_path_buf()); - mappings - .insert(&mapping.key.clone(), mapping) - .context("Failed to insert a key")?; + let mapping_key = mapping.key.clone(); + mappings.insert(&mapping_key, mapping).with_context(|| { + format!( + "Failed to insert '{}' for path: '{}'\nMapTree is now: \n{}", + MapKey::display(&mapping_key), + directory.path().display(), + mappings, + ) + })?; } } todo!() -- cgit 1.4.1