Skip to main content

on_deep_stack

Function on_deep_stack 

Source
pub fn on_deep_stack<T, F>(work: F) -> DeepStack<T>
where T: Send, F: FnOnce() -> T + Send,
Expand description

Runs work on a dedicated thread with a large reserved stack (DEEP_STACK), so deeply nested input cannot overflow the caller’s stack.

The closure is consumed whether or not a worker starts, so a caller that wants to retry on the current stack expresses the work as a re-callable expression and rebuilds it in the DeepStack::NotSpawned arm.