presolve_compiler/
layout_graph.rs1use crate::application_semantic_model::ApplicationSemanticModel;
2use crate::semantic_id::SemanticId;
3
4#[derive(Debug, Clone, PartialEq, Eq)]
5pub struct LayoutGraph {
6 pub routes: Vec<RouteLayoutNode>,
7}
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub struct RouteLayoutNode {
10 pub path: String,
11 pub component: SemanticId,
12 pub layouts: Vec<SemanticId>,
13}
14
15#[must_use]
16pub fn build_layout_graph(model: &ApplicationSemanticModel) -> LayoutGraph {
17 LayoutGraph {
18 routes: model
19 .components
20 .iter()
21 .filter_map(|component| {
22 component.route_path.as_ref().map(|path| RouteLayoutNode {
23 path: path.clone(),
24 component: component.id.clone(),
25 layouts: Vec::new(),
26 })
27 })
28 .collect(),
29 }
30}