mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Name the crate cluster tuple as a type alias
This commit is contained in:
@@ -249,6 +249,9 @@ fn dot_to_svg(dot: &str) -> Result<String> {
|
|||||||
String::from_utf8(output.stdout).with_context(|| "SVG output was not valid UTF-8")
|
String::from_utf8(output.stdout).with_context(|| "SVG output was not valid UTF-8")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A subgraph cluster's id, label, fill color, and the predicate picking its crates.
|
||||||
|
type Cluster<'a> = (&'a str, &'a str, &'a str, Box<dyn Fn(&CrateInfo) -> bool>);
|
||||||
|
|
||||||
fn generate_dot(crates: &[CrateInfo]) -> String {
|
fn generate_dot(crates: &[CrateInfo]) -> String {
|
||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
out.push_str("digraph CrateHierarchy {\n");
|
out.push_str("digraph CrateHierarchy {\n");
|
||||||
@@ -257,7 +260,7 @@ fn generate_dot(crates: &[CrateInfo]) -> String {
|
|||||||
out.push_str(" edge [color=gray];\n\n");
|
out.push_str(" edge [color=gray];\n\n");
|
||||||
|
|
||||||
// Define subgraph clusters
|
// Define subgraph clusters
|
||||||
let clusters: &[(&str, &str, &str, Box<dyn Fn(&CrateInfo) -> bool>)] = &[
|
let clusters: &[Cluster] = &[
|
||||||
(
|
(
|
||||||
"cluster_core",
|
"cluster_core",
|
||||||
"Core Components",
|
"Core Components",
|
||||||
|
|||||||
Reference in New Issue
Block a user