pub struct IndexedGraph {
pub graph: StaticGraph,
pub nodes_by_id: HashMap<String, StaticNode>,
pub children_by_node: HashMap<String, Vec<String>>,
pub nodes_by_alias: HashMap<String, StaticNode>,
pub nodegroups_by_id: HashMap<String, StaticNodegroup>,
}Expand description
Graph with precomputed indices for efficient tree traversal
Fields§
§graph: StaticGraph§nodes_by_id: HashMap<String, StaticNode>node_id -> StaticNode
children_by_node: HashMap<String, Vec<String>>node_id -> [child_node_ids]
nodes_by_alias: HashMap<String, StaticNode>alias -> StaticNode
nodegroups_by_id: HashMap<String, StaticNodegroup>nodegroup_id -> StaticNodegroup
Implementations§
Source§impl IndexedGraph
impl IndexedGraph
Sourcepub fn new(graph: StaticGraph) -> Self
pub fn new(graph: StaticGraph) -> Self
Create an indexed graph from a StaticGraph
Sourcepub fn get_root(&self) -> &StaticNode
pub fn get_root(&self) -> &StaticNode
Get root node
Sourcepub fn get_node(&self, node_id: &str) -> Option<&StaticNode>
pub fn get_node(&self, node_id: &str) -> Option<&StaticNode>
Get node by ID
Sourcepub fn get_node_by_alias(&self, alias: &str) -> Option<&StaticNode>
pub fn get_node_by_alias(&self, alias: &str) -> Option<&StaticNode>
Get node by alias
Sourcepub fn get_children(&self, node_id: &str) -> Vec<&StaticNode>
pub fn get_children(&self, node_id: &str) -> Vec<&StaticNode>
Get child nodes for a given node ID
Sourcepub fn get_child_ids(&self, node_id: &str) -> Vec<&String>
pub fn get_child_ids(&self, node_id: &str) -> Vec<&String>
Get child node IDs for a given node
Sourcepub fn has_children(&self, node_id: &str) -> bool
pub fn has_children(&self, node_id: &str) -> bool
Check if a node has children
Sourcepub fn get_nodegroup(&self, node: &StaticNode) -> Option<&StaticNodegroup>
pub fn get_nodegroup(&self, node: &StaticNode) -> Option<&StaticNodegroup>
Get the nodegroup for a node
Sourcepub fn build_descriptors(
&self,
tiles: &[StaticTile],
) -> StaticResourceDescriptors
pub fn build_descriptors( &self, tiles: &[StaticTile], ) -> StaticResourceDescriptors
Build resource descriptors from tiles using graph configuration
This replaces the TypeScript buildResourceDescriptors function, making descriptor computation completely platform-independent.
§Arguments
tiles- The resource tiles containing data values
§Returns
Populated StaticResourceDescriptors with name, description, map_popup fields
Sourcepub fn build_descriptors_with_diagnostics(
&self,
tiles: &[StaticTile],
warnings: &mut Vec<String>,
cache: Option<&ResourceCache>,
) -> StaticResourceDescriptors
pub fn build_descriptors_with_diagnostics( &self, tiles: &[StaticTile], warnings: &mut Vec<String>, cache: Option<&ResourceCache>, ) -> StaticResourceDescriptors
Build descriptors with diagnostic warnings for silent failure cases
Sourcepub fn build_descriptors_with_context(
&self,
tiles: &[StaticTile],
warnings: &mut Vec<String>,
cache: Option<&ResourceCache>,
extension_registry: Option<&ExtensionTypeRegistry>,
) -> StaticResourceDescriptors
pub fn build_descriptors_with_context( &self, tiles: &[StaticTile], warnings: &mut Vec<String>, cache: Option<&ResourceCache>, extension_registry: Option<&ExtensionTypeRegistry>, ) -> StaticResourceDescriptors
Build descriptors with full context (diagnostics, cache, extension registry)
Sourcepub fn extract_placeholders(template: &str) -> Vec<String>
pub fn extract_placeholders(template: &str) -> Vec<String>
Extract placeholders from template using regex pattern
Finds patterns like