workspacer_topo/lib.rs
1// ---------------- [ File: workspacer-topo/src/lib.rs ]
2// workspacer-topo/src/lib.rs
3//
4// This shows how to invert the design so that:
5//
6// 1) We have a `TopologicalSortConfig` config struct (the "strategy" object).
7// 2) The main trait implementations (`BasicTopologicalSort`, `LayeredTopologicalSort`,
8// `FocusCrateTopologicalSort`) live on `Workspace<P, H>` and `CrateHandle`, rather
9// than on the `TopologicalSortConfig` itself. That means you can do:
10//
11// let sorter = TopologicalSorterBuilder::default()
12// .reverse_order(true)
13// // etc
14// .build()
15// .unwrap();
16//
17// let topo_list = my_workspace.topological_order_crate_names(&sorter).await?;
18//
19// let layered = my_workspace.layered_topological_order_crate_names(&sorter).await?;
20//
21// let partial = my_workspace.topological_order_upto_crate(&sorter, "focus_crate").await?;
22//
23// let partial_handle = my_crate_handle.topological_sort_internal_deps(&sorter).await?;
24//
25// The `TopologicalSortConfig` is just a config (fields: `reverse_order`, `filter_fn`, etc),
26// while each trait method is implemented *on* either `Workspace<P, H>` or `CrateHandle`,
27// with the `config: &TopologicalSortConfig` guiding how we do filtering, layering, reversing, etc.
28//
29// ---------------------------------------------------------------------------
30#[macro_use] mod imports; use imports::*;
31
32x!{basic_topologcal_sort}
33x!{config}
34x!{focus_crate_topological_sort}
35x!{layered_subgraph_internal}
36x!{layered_topologcal_sort}
37x!{topological_sort_internal_deps}
38x!{traits}
39x!{add_crate_and_deps}
40x!{mock}