Skip to main content

with_saved_settings

Function with_saved_settings 

Source
pub fn with_saved_settings<T>(f: impl FnOnce() -> T) -> T
Expand description

Runs f, restoring the calling thread’s settings afterwards, including on panic.

Changes inside the closure stay local to the scope. Random state, pending heuristic answers, recorded choices and uniform representations are restored along with configuration values.