Skip to main content

Job

Type Alias Job 

Source
pub type Job = Box<dyn FnOnce() + Send + 'static>;
Expand description

One unit of work handed to a standing fan.

A boxed FnOnce and not a pure descriptor, and that is a compromise worth naming: a descriptor would be operate(op) in its ideal form, but the git transfer it has to carry is an async future over a live socket, and the honest bridge to an OS thread is a closure that owns it. One box per operation is one allocation — against the ~27.6 M this design exists to remove, and against tokio’s blocking pool spawning a THREAD for the same work. It is not zero; it is four orders of magnitude off the thing that hurt.

Aliased Type§

pub struct Job(/* private fields */);