MCPcopy Create free account
hub / github.com/PerroEngine/Perro / insert

Method insert

perro_source/runtime_project/perro_runtime/src/cns/node_arena.rs:153–184  ·  view source on GitHub ↗

Insert a node and return its current slot/generation id. Reuses a free slot when available. Otherwise appends a new slot.

(&mut self, node: SceneNode)

Source from the content-addressed store, hash-verified

151pub(crate) struct ScopedNodeMut<'a> {
152 arena: &'a mut NodeArena,
153 index: usize,
154 armed: bool,
155}
156
157impl ScopedNodeMut<'_> {
158 /// End a normally classified callback. Unwind before this call leaves the
159 /// guard armed so drop invalidates every dependent domain.
160 #[inline]
161 pub(crate) fn finish(mut self) {
162 self.armed = false;
163 }
164}
165
166impl Deref for ScopedNodeMut<'_> {
167 type Target = SceneNode;
168
169 fn deref(&self) -> &Self::Target {
170 self.arena.nodes[self.index]
171 .as_ref()
172 .expect("scoped node slot stays live while borrowed")
173 }
174}
175
176impl DerefMut for ScopedNodeMut<'_> {
177 fn deref_mut(&mut self) -> &mut Self::Target {
178 self.arena.nodes[self.index]
179 .as_mut()
180 .expect("scoped node slot stays live while borrowed")
181 }
182}
183
184impl Drop for ScopedNodeMut<'_> {
185 fn drop(&mut self) {
186 if self.armed {
187 self.arena.bump_world_state_revisions();

Callers 15

sanitize_panim_identFunction · 0.45
push_recent_node_typeFunction · 0.45
add_recent_projectFunction · 0.45
filtered_file_pathsFunction · 0.45
file_dirs_with_childrenFunction · 0.45
sanitize_node_nameFunction · 0.45
inspector_tag_rowsFunction · 0.45

Calls 7

bump_mutation_versionMethod · 0.80
cloneMethod · 0.80
node_typeMethod · 0.80
popMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45
is_emptyMethod · 0.45

Tested by 15

inspector_tag_rowsFunction · 0.36
parse_script_importsFunction · 0.36
module_name_from_relFunction · 0.36
sample_profileFunction · 0.36