pub struct SyncRegistryScope { /* private fields */ }Expand description
RAII guard that installs a registry on the thread-local slot for the lifetime of the guard.
The previous value (if any) is captured on construction and restored on drop, so nested scopes compose correctly. Used by synchronous Runtime entry points (CLI, unit tests, REPL one-shot) that are not running under a tokio task.
ⓘ
let _scope = SyncRegistryScope::enter(runtime.schema_registry_arc());
// ... invoke any code that calls current_registry() ...
// scope restores previous value on dropImplementations§
Source§impl SyncRegistryScope
impl SyncRegistryScope
Sourcepub fn enter(registry: Arc<TypeSchemaRegistry>) -> Self
pub fn enter(registry: Arc<TypeSchemaRegistry>) -> Self
Install registry as the current thread-local registry, saving the
previous value for restoration on drop.
Trait Implementations§
Source§impl Drop for SyncRegistryScope
impl Drop for SyncRegistryScope
Auto Trait Implementations§
impl Freeze for SyncRegistryScope
impl RefUnwindSafe for SyncRegistryScope
impl Send for SyncRegistryScope
impl Sync for SyncRegistryScope
impl Unpin for SyncRegistryScope
impl UnsafeUnpin for SyncRegistryScope
impl UnwindSafe for SyncRegistryScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more