Skip to content

Commit

Permalink
external dependencies added
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-huegel committed Dec 20, 2023
1 parent f3d17d9 commit da6f447
Show file tree
Hide file tree
Showing 14 changed files with 544 additions and 249 deletions.
8 changes: 8 additions & 0 deletions modules.dot
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ style="filled"
"::app_builder" -> "::dependencies_graph"
"::app_builder" -> "::dot_formatter"
"::app_builder" -> "::files_reader"
"::app_builder" -> "std"
"::dependencies_graph" -> "::dependency_components"
"::dependencies_graph" -> "::trie"
"::dependencies_parser" -> "::dependency_components"
"::dependencies_parser" -> "lazy_static"
"::dependencies_parser" -> "regex"
"::dependencies_parser" -> "std"
"::dot_formatter" -> "::colors"
"::dot_formatter" -> "::dependencies_graph"
"::dot_formatter" -> "::dependency_components"
"::dot_formatter" -> "std"
"::files_reader" -> "::dependencies_graph"
"::files_reader" -> "::dependencies_parser"
"::files_reader" -> "std"
"::main" -> "::app_builder"
"::main" -> "std"
"::trie" -> "std"
}

Binary file modified modules.pdf
Binary file not shown.
Binary file modified modules.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions self-graphmod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cargo run > modules.dot
tred modules.dot | dot -Tpdf > modules.pdf
tred modules.dot | dot -Tpdf > modules.svg
12 changes: 3 additions & 9 deletions src/colors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@
*/

pub fn make_gray(level: usize) -> String {
let l = if level > 16 {
0
} else {
15 - level
} as u32;
let l = if level > 16 { 0 } else { 15 - level } as u32;
let c = String::from(char::from_digit(l, 16).unwrap_or('f')).repeat(2);
String::from("#") + &c.repeat(3)
}

pub fn make_random_color(dirname: &str) -> String {
let n: u32 = dirname.chars()
.filter_map(|c| c.to_digit(36))
.sum();
let n: u32 = dirname.chars().filter_map(|c| c.to_digit(36)).sum();
let red = (255 - n * 71 % 128) as u8;
let green = (255 - n * 131 % 128) as u8;
let blue = (255 - n * 29 % 128) as u8;
Expand All @@ -39,4 +33,4 @@ mod tests {
fn it_makes_a_random_color() {
assert_eq!(String::from("#b6b2ec"), make_random_color("::foo::bar"))
}
}
}
3 changes: 1 addition & 2 deletions src/dependencies_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* This file is part of Cargo Graphmod.
* SPDX-License-Identifier: GPL-3.0-only
*/

use crate::{trie::Trie, dependency_components::DependencyComponents};
use crate::{dependency_components::DependencyComponents, trie::Trie};

pub type DependenciesGraph = Trie<String, Vec<DependencyComponents>>;
Loading

0 comments on commit da6f447

Please sign in to comment.