Skip to main content

PrintJobFuture

Type Alias PrintJobFuture 

Source
pub type PrintJobFuture = Pin<Box<dyn Future<Output = JobOutcome> + Send>>;
Expand description

Callback that prints one document to the device, returning a JobOutcome that tells the framework what to do with the job.

It receives the payload by reference because the framework may call it more than once: returning JobOutcome::DeviceUnavailable makes the framework hold the job and re-invoke this callback (with backoff) until it prints or the client cancels — so classify a transient device condition as DeviceUnavailable, not Failed. Do any cheap reachability check (opening the device) first so a held retry is cheap. The callback should also bail early if JobContext::is_canceled becomes true. Boxed, owned future a PrintJobFn returns. The payload is handed over as an Arc<[u8]> (not a borrow) so the future is 'static and can run on a spawned task that outlives the call.

Aliased Type§

#[repr(transparent)]
pub struct PrintJobFuture { /* private fields */ }