MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / rootless_mutate

Function rootless_mutate

aiscript-arena/src/arena.rs:390–398  ·  view source on GitHub ↗

Create a temporary arena without a root object and perform the given operation on it. No garbage collection will be done until the very end of the call, at which point all allocations will be collected. This is a convenience function that makes it a little easier to quickly test code that uses `gc-arena`, it is not very useful on its own.

(f: F)

Source from the content-addressed store, hash-verified

388/// This is a convenience function that makes it a little easier to quickly test code that uses
389/// `gc-arena`, it is not very useful on its own.
390pub fn rootless_mutate<F, R>(f: F) -> R
391where
392 F: for<'gc> FnOnce(&'gc Mutation<'gc>) -> R,
393{
394 unsafe {
395 let context = Context::new();
396 f(context.mutation_context())
397 }
398}

Callers 3

test_parse_functionFunction · 0.85
test_parse_agentFunction · 0.85
test_string_headerFunction · 0.85

Calls 1

mutation_contextMethod · 0.80

Tested by 3

test_parse_functionFunction · 0.68
test_parse_agentFunction · 0.68
test_string_headerFunction · 0.68