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 — and the printer domain’s vocabulary: the state a printer reports (state), the closed set of things an adjustment may change (adjustable), the snapshots those reads answer (snapshot) and the plausibility ranges their reported numbers are read against (ranges). A change to what a printer reports edits this crate and the adapters behind it, and nothing central.

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 every port 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.

Re-exports§

pub use adjustable::Adjustable;
pub use adjustable::AdjustableError;
pub use ranges::COMPLETION_RANGE;
pub use ranges::FAN_PERCENT_RANGE;
pub use ranges::FEEDRATE_FACTOR_RANGE;
pub use ranges::FLOWRATE_FACTOR_RANGE;
pub use ranges::HEATER_ACTUAL_C_RANGE;
pub use ranges::HEATER_OFFSET_C_RANGE;
pub use ranges::HEATER_TARGET_C_RANGE;
pub use ranges::RANGED_FIELDS;
pub use ranges::RangedField;
pub use snapshot::HeaterSnapshot;
pub use snapshot::JobSnapshot;
pub use snapshot::PrinterSnapshot;
pub use state::PrinterState;

Modules§

adjustable
The closed set of things an adjustment may change.
ranges
The plausibility ranges the printer port declares for what a printer reports.
snapshot
Normalized observations of a printer and of the job it is running.
state
The state a source reports a printer or a print to be in.

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.