Skip to main content

Crate printobserver_printer_api

Crate printobserver_printer_api 

Source
Expand description

printobserver-printer-api.

Owns: the port the physical printer speaks through — the trait for reading printer and job state and for asking the machine to do one of the bounded things the action vocabulary names, plus that port’s own error type.

May depend on: printobserver-types only. A port that named an implementation would stop being a port.

§What this port does not expose

There is no method that accepts a command string, and that absence is the contract rather than an omission: no method here admits a byte sequence at all, and the only string anywhere in the closure reachable from a method’s parameters is the one FileName wraps, which exactly one method — PrinterPort::start — takes. Every value a method takes is already bounded by the time it arrives: policy has ruled on it before it gets here.

§Why the methods answer a boxed future

Every method is asynchronous, and the trait is dyn-compatible and shareable across threads, because the supervision core holds all four ports behind Arc<dyn Port>. An async fn in a trait is not dyn-compatible, so each method answers a BoxFuture instead: the same asynchrony, in the one shape a trait object can carry.

Enums§

PrinterError
Why the printer did not do what it was asked.

Traits§

PrinterPort
The port the physical printer speaks through.

Type Aliases§

BoxFuture
A future this port’s methods answer with, in the one shape a trait object can carry.