Skip to main content

work

Function work 

Source
pub fn work<T>(name: &str, body: impl FnOnce() -> T) -> T
Expand description

What: Run body as work named name on any thread, adding its time to the name’s sum; with no recording begun, body runs alone. Why: The repair of package managers runs its tools on worker threads, which the thread’s own steps cannot see; the sum over threads says how much work a step held, and the step that waited for it says how long the add waited.

In TS you’d write (pseudocode):

const value = work('clone', () => cloneTree());