pub fn set_session_globals_then<R>(
    session_globals: &SessionGlobals,
    f: impl FnOnce() -> R
) -> R