pub struct SceneGraph {
pub graph: DiGraph<SceneNode, ()>,
pub root: NodeIndex,
pub styles: HashMap<NodeId, Style>,
pub id_index: HashMap<NodeId, NodeIndex>,
}Expand description
The complete FD document — a DAG of SceneNode values.
Edges go from parent → child. Style definitions are stored separately in a hashmap for lookup by name.
Fields§
§graph: DiGraph<SceneNode, ()>The underlying directed graph.
root: NodeIndexThe root node index.
styles: HashMap<NodeId, Style>Named style definitions (style base_text { ... }).
id_index: HashMap<NodeId, NodeIndex>Index from NodeId → NodeIndex for fast lookup.
Implementations§
Source§impl SceneGraph
impl SceneGraph
Sourcepub fn add_node(&mut self, parent: NodeIndex, node: SceneNode) -> NodeIndex
pub fn add_node(&mut self, parent: NodeIndex, node: SceneNode) -> NodeIndex
Add a node as a child of parent. Returns the new node’s index.
Sourcepub fn get_by_id_mut(&mut self, id: NodeId) -> Option<&mut SceneNode>
pub fn get_by_id_mut(&mut self, id: NodeId) -> Option<&mut SceneNode>
Look up a node mutably by its @id.
Sourcepub fn children(&self, idx: NodeIndex) -> Vec<NodeIndex>
pub fn children(&self, idx: NodeIndex) -> Vec<NodeIndex>
Get children of a node in insertion order.
Sourcepub fn define_style(&mut self, name: NodeId, style: Style)
pub fn define_style(&mut self, name: NodeId, style: Style)
Define a named style.
Sourcepub fn resolve_style(&self, node: &SceneNode) -> Style
pub fn resolve_style(&self, node: &SceneNode) -> Style
Resolve a node’s effective style (merging use references + inline overrides).
Sourcepub fn rebuild_index(&mut self)
pub fn rebuild_index(&mut self)
Rebuild the id_index (needed after deserialization).
Trait Implementations§
Source§impl Clone for SceneGraph
impl Clone for SceneGraph
Source§fn clone(&self) -> SceneGraph
fn clone(&self) -> SceneGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SceneGraph
impl Debug for SceneGraph
Auto Trait Implementations§
impl Freeze for SceneGraph
impl RefUnwindSafe for SceneGraph
impl Send for SceneGraph
impl Sync for SceneGraph
impl Unpin for SceneGraph
impl UnsafeUnpin for SceneGraph
impl UnwindSafe for SceneGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more