pub trait DeviceBackend: Send + Sync {
// Required methods
fn list(&self, emit: &mut dyn FnMut(&str, &str, &str) -> bool);
fn driver_for_device(
&self,
device_id: &str,
device_uri: &str,
) -> Option<String>;
// Provided methods
fn poll_status(&self, _config: &PrinterConfig) -> Option<PollStatus> { ... }
fn identify(&self, _config: &PrinterConfig, _actions: &[String]) { ... }
}Expand description
Enumerate physical printers and report their live health.
Implementations describe how to discover devices (e.g. via sysfs, BlueZ, USB enumeration) and how to map their identifying strings to a driver name registered with the framework.
Required Methods§
Provided Methods§
Sourcefn poll_status(&self, _config: &PrinterConfig) -> Option<PollStatus>
fn poll_status(&self, _config: &PrinterConfig) -> Option<PollStatus>
Query live status for a registered printer. The background status loop
calls this on each idle printer and updates the IPP attributes when the
value changes. Returning None means “no update” (keep whatever the
registry already holds); returning Some carries the fresh reasons and,
optionally, the loaded media and remaining-supply level.
Sourcefn identify(&self, _config: &PrinterConfig, _actions: &[String])
fn identify(&self, _config: &PrinterConfig, _actions: &[String])
Handle an Identify-Printer request (PWG 5100.14 §5.1) — make the
physical device announce itself (beep, flash an LED, …). actions
holds the requested identify-actions keywords (display, sound,
flash, speak); an empty slice means “use the default action”.
Default: no-op.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".