pub struct PrinterConfig {Show 14 fields
pub name: String,
pub display_name: String,
pub driver_name: String,
pub make_and_model: String,
pub device_id: String,
pub device_uri: String,
pub dpi: i32,
pub printhead_width_dots: u32,
pub media_names: Vec<String>,
pub media_sizes: Vec<[i32; 2]>,
pub media_size_min: [i32; 2],
pub media_size_max: [i32; 2],
pub darkness: i32,
pub document_formats: Vec<String>,
}Expand description
Static printer capabilities supplied by the consumer crate (typically
loaded from a config file). Carries everything the framework needs to
build the IPP Get-Printer-Attributes response.
Fields§
§name: StringLogical, machine-readable name: the CUPS queue name, the IPP
printer-name, the /ipp/print/<name> resource path, and the mDNS
rp TXT all use this. Keep it to [a-z0-9_] so it round-trips through
CUPS’s own DNS-SD queue-name sanitiser (cups_queue_name), letting a
co-resident CUPS recognise its on-demand temp queue as already-served
(its lookup is case-insensitive).
display_name: StringHuman-readable name shown to users: the mDNS service instance name
(what OS print dialogs display), IPP printer-info, and the web UI.
May contain spaces / mixed case. Empty falls back to make_and_model,
then name. #[serde(default)] so older persisted state still loads.
driver_name: String§make_and_model: String§device_id: String§device_uri: String§dpi: i32§printhead_width_dots: u32§media_names: Vec<String>§media_sizes: Vec<[i32; 2]>§media_size_min: [i32; 2]Smallest and largest custom media the printer accepts, [x, y] in
hundredths of a millimetre.
When both are non-zero, media-size-supported gains a range entry and
the PWG custom_min_* / custom_max_* names join media-supported —
which is what makes a desktop print dialog offer a Custom size rather
than only the enumerated list. Leave either zeroed to advertise fixed
sizes only. #[serde(default)] so state written before this existed
still loads.
media_size_max: [i32; 2]§darkness: i32Darkness 0–100 (maps to print density).
document_formats: Vec<String>MIME types the consumer’s print callback can decode, emitted as
document-format-supported. Empty falls back to the framework’s raster
defaults (image/pwg-raster, application/vnd.cups-raster,
application/octet-stream). Add image/jpeg etc. when the backend can
handle them.
Implementations§
Source§impl PrinterConfig
impl PrinterConfig
Sourcepub fn printer_uri(&self, host: &str, port: u16) -> String
pub fn printer_uri(&self, host: &str, port: u16) -> String
Build the canonical ipp://<host>:<port>/ipp/print/<name> URI. If
host is unspecified (0.0.0.0, ::, empty), advertises
localhost so CUPS and mDNS clients get a reachable address.
Sourcepub fn display_label(&self) -> &str
pub fn display_label(&self) -> &str
The effective human-readable label: display_name if set, else
make_and_model, else the logical name. Used for the mDNS service
instance name, IPP printer-info, and the web UI.
Trait Implementations§
Source§impl Clone for PrinterConfig
impl Clone for PrinterConfig
Source§fn clone(&self) -> PrinterConfig
fn clone(&self) -> PrinterConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more