Skip to main content

with_native_ops

Function with_native_ops 

Source
pub fn with_native_ops<R>(
    ops: &mut dyn NativeOps,
    body: impl FnOnce() -> R,
) -> R
Expand description

Installs ops as the current thread’s dispatcher for the duration of body, then restores the previous dispatcher.

Nesting-safe: an inner with_native_ops saves and restores the outer dispatcher. Panic-safe: the previous dispatcher is restored even if body unwinds (the restore runs in a guard’s Drop).