diff options
author | HampusM <hampus@hampusmat.com> | 2022-08-02 17:30:21 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-08-02 17:30:21 +0200 |
commit | f35b3d29d8ed521f69522aa0fda594f277c72b5c (patch) | |
tree | 341a61ff1e0e8e528197c30edee9e4745df65a27 /src | |
parent | c6aa8be159b83ceb74472f95490f78cf72b74cc9 (diff) |
refactor: move creating a dependency trace to it's own function
Diffstat (limited to 'src')
-rw-r--r-- | src/dependency_trace.rs | 20 | ||||
-rw-r--r-- | src/lib.rs | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/dependency_trace.rs b/src/dependency_trace.rs new file mode 100644 index 0000000..d46b762 --- /dev/null +++ b/src/dependency_trace.rs @@ -0,0 +1,20 @@ +#![allow(clippy::module_name_repetitions)] + +#[must_use] +pub fn create_dependency_trace( + dependency_history: &[&'static str], + err_dependency: &'static str, +) -> String +{ + dependency_history + .iter() + .map(|dep| { + if dep == &err_dependency { + format!("\x1b[1m{}\x1b[22m", dep) + } else { + (*dep).to_string() + } + }) + .collect::<Vec<_>>() + .join(" -> ") +} @@ -20,6 +20,9 @@ pub use syrette_macros::*; pub mod castable_factory; #[doc(hidden)] +pub mod dependency_trace; + +#[doc(hidden)] pub mod libs; // Private |