MCPcopy Create free account
hub / github.com/AccessKit/accesskit / add_node

Method add_node

consumer/src/tree.rs:190–216  ·  view source on GitHub ↗
(
            nodes: &mut HashMap<NodeId, NodeState>,
            pending_grafts: &mut HashMap<TreeId, NodeId>,
            changes: &mut Option<&mut InternalChanges>,
            parent_and_index: Op

Source from the content-addressed store, hash-verified

188 }
189
190 fn add_node(
191 nodes: &mut HashMap<NodeId, NodeState>,
192 pending_grafts: &mut HashMap<TreeId, NodeId>,
193 changes: &mut Option<&mut InternalChanges>,
194 parent_and_index: Option<ParentAndIndex>,
195 id: NodeId,
196 data: NodeData,
197 ) {
198 if let Some(subtree_id) = data.tree_id() {
199 if !data.children().is_empty() {
200 panic!(
201 "Node {:?} has both tree_id and children. \
202 A graft node's only child comes from its subtree.",
203 id.to_components().0
204 );
205 }
206 record_graft(pending_grafts, subtree_id, id);
207 }
208 let state = NodeState {
209 parent_and_index,
210 data,
211 };
212 nodes.insert(id, state);
213 if let Some(changes) = changes {
214 changes.added_node_ids.insert(id);
215 }
216 }
217
218 for (local_node_id, node_data) in update.nodes {
219 let node_id = map_id(local_node_id);

Callers

nothing calls this directly

Calls 2

childrenMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected