Skip to main content

IndexedGraph

Struct IndexedGraph 

Source
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

Source

pub fn new(graph: StaticGraph) -> Self

Create an indexed graph from a StaticGraph

Source

pub fn get_root(&self) -> &StaticNode

Get root node

Source

pub fn get_node(&self, node_id: &str) -> Option<&StaticNode>

Get node by ID

Source

pub fn get_node_by_alias(&self, alias: &str) -> Option<&StaticNode>

Get node by alias

Source

pub fn get_children(&self, node_id: &str) -> Vec<&StaticNode>

Get child nodes for a given node ID

Source

pub fn get_child_ids(&self, node_id: &str) -> Vec<&String>

Get child node IDs for a given node

Source

pub fn has_children(&self, node_id: &str) -> bool

Check if a node has children

Source

pub fn get_nodegroup(&self, node: &StaticNode) -> Option<&StaticNodegroup>

Get the nodegroup for a node

Source

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

Source

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

Source

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)

Source

pub fn extract_placeholders(template: &str) -> Vec<String>

Extract placeholders from template using regex pattern Finds patterns like in the template string

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.