aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-08-02 17:30:21 +0200
committerHampusM <hampus@hampusmat.com>2022-08-02 17:30:21 +0200
commitf35b3d29d8ed521f69522aa0fda594f277c72b5c (patch)
tree341a61ff1e0e8e528197c30edee9e4745df65a27 /src
parentc6aa8be159b83ceb74472f95490f78cf72b74cc9 (diff)
refactor: move creating a dependency trace to it's own function
Diffstat (limited to 'src')
-rw-r--r--src/dependency_trace.rs20
-rw-r--r--src/lib.rs3
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(" -> ")
+}
diff --git a/src/lib.rs b/src/lib.rs
index 4d1ce78..a03675b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -20,6 +20,9 @@ pub use syrette_macros::*;
pub mod castable_factory;
#[doc(hidden)]
+pub mod dependency_trace;
+
+#[doc(hidden)]
pub mod libs;
// Private