MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / map_root

Method map_root

aiscript-arena/src/arena.rs:165–182  ·  view source on GitHub ↗
(
        self,
        f: impl for<'gc> FnOnce(&'gc Mutation<'gc>, Root<'gc, R>) -> Root<'gc, R2>,
    )

Source from the content-addressed store, hash-verified

163
164 #[inline]
165 pub fn map_root<R2>(
166 self,
167 f: impl for<'gc> FnOnce(&'gc Mutation<'gc>, Root<'gc, R>) -> Root<'gc, R2>,
168 ) -> Arena<R2>
169 where
170 R2: for<'a> Rootable<'a>,
171 for<'a> Root<'a, R2>: Sized,
172 {
173 self.context.root_barrier();
174 let new_root: Root<'static, R2> = unsafe {
175 let mc: &'static Mutation<'_> = &*(self.context.mutation_context() as *const _);
176 f(mc, self.root)
177 };
178 Arena {
179 context: self.context,
180 root: new_root,
181 }
182 }
183
184 #[inline]
185 pub fn try_map_root<R2, E>(

Callers

nothing calls this directly

Calls 2

root_barrierMethod · 0.80
mutation_contextMethod · 0.80

Tested by

no test coverage detected