pub trait PrinterSource: Send + Sync {
// Required methods
fn current(&self) -> PrinterStatus;
fn subscribe(&self) -> Receiver<PrinterStatus>;
}Expand description
Something that can provide the printer’s current status and a live stream of
updates. Abstracted so the server is testable without a network: tests and
--fake mode use FakeSource, the live source (P2) wraps the MQTT monitor.
Required Methods§
Sourcefn current(&self) -> PrinterStatus
fn current(&self) -> PrinterStatus
The latest known status.
Sourcefn subscribe(&self) -> Receiver<PrinterStatus>
fn subscribe(&self) -> Receiver<PrinterStatus>
Subscribe to status updates. The receiver’s current value is whatever
the source last held; callers should send it first (via borrow_and_update)
and then await changed() for each subsequent update.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".