Function with_thread_host
pub fn with_thread_host<T: 'static, R>(
build: impl FnOnce() -> LuaHost<T>,
f: impl FnOnce(&mut LuaHost<T>) -> R,
) -> Option<R>Expand description
Run f against this thread’s lazily-built LuaHost<T>.
A LuaHost is !Send — luna-core’s Vm holds Rcs and raw GC
pointers — so a thread-per-core server cannot park it inside its
Send per-shard command value. This slot keeps one host per shard
thread instead: identical isolation (thread == shard), owned by
the crate that knows why the type can’t travel.
build runs once, on the first call on this thread. Returns
None when the slot is already borrowed — a re-entrant eval on
the same thread; callers surface their nested-eval error. A parked
host of a different T (mixed test harnesses; production uses
one T per process) is dropped and rebuilt.