Skip to main content

install

Function install 

Source
pub fn install(
    cfg: AutoExportConfig,
    tracker: Arc<GlobalTracker>,
) -> MemScopeResult<()>
Expand description

Store the tracker + config and install all enabled exit hooks (panic hook always; ctrlc handler if the auto-signal feature is enabled; atexit hook if the atexit feature is enabled).

Idempotent: calling twice is safe — the tracker/cfg are overwritten (last wins) and [HOOKS_INSTALLED] ensures hooks install only once per process.

§Errors

Returns MemScopeError only if storing the tracker/cfg fails. With parking_lot (which never poisons) this does not happen in practice, but the Result is preserved so callers can use ? uniformly.