MCPcopy Index your code
hub / github.com/RustPython/RustPython / with_deferred_drops

Function with_deferred_drops

crates/common/src/refcount.rs:231–241  ·  view source on GitHub ↗
(f: F)

Source from the content-addressed store, hash-verified

229#[cfg(feature = "std")]
230#[inline]
231pub fn with_deferred_drops<F, R>(f: F) -> R
232where
233 F: FnOnce() -> R,
234{
235 let _guard = IN_DEFERRED_CONTEXT.with(|in_ctx| {
236 let was_in_context = in_ctx.get();
237 in_ctx.set(true);
238 DeferredDropGuard { was_in_context }
239 });
240 f()
241}
242
243/// Try to defer a drop-related operation.
244/// If inside a deferred context, the operation is queued.

Callers 1

collect_innerMethod · 0.85

Calls 4

withMethod · 0.80
fFunction · 0.50
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected