Skip to main content

reset_thread_state

Function reset_thread_state 

Source
pub fn reset_thread_state()
Expand description

Free every definition/register/box this thread accumulated, returning all three State singletons (STATE, STD_STATE, STY_STATE) to a fresh, empty baseline and the rotation to Main.

Danger: this invalidates all live definitions/SymStr-keyed data on the thread. Sound only between fully independent conversions in a reused process — the test harness (each test serializes to owned Strings, then resets before its thread exits) or a future daemon that re-initializes afterward. The single-conversion binary never calls this; it exits instead. Pairs with crate::common::arena::reset — see crate::reset_thread_engine for the combined entry point and the #[thread_local]-no-drop rationale.