pub struct PrinterConfig {
pub last_printer_id: Option<String>,
pub last_backend: Option<String>,
pub global_settings: HashMap<String, String>,
pub printer_settings: HashMap<String, HashMap<String, String>>,
}zbus-backend only.Expand description
Saved user preferences for the print dialog.
Keeps track of the last selected printer, global default settings, and per-printer customized settings (e.g. paper size, quality options).
Fields§
§last_printer_id: Option<String>Last-used printer identifier
last_backend: Option<String>Last-used backend name
global_settings: HashMap<String, String>Global settings that apply to all printers unless overridden (e.g. "copies" => "1")
printer_settings: HashMap<String, HashMap<String, String>>Per-printer settings keyed by "printer_id@backend"
Implementations§
Source§impl PrinterConfig
impl PrinterConfig
Sourcepub fn has_printer(&self) -> bool
pub fn has_printer(&self) -> bool
Returns true if this config has a saved printer.
Sourcepub fn set_last_printer(&mut self, printer_id: &str, backend: &str)
pub fn set_last_printer(&mut self, printer_id: &str, backend: &str)
Sets the last-used printer and backend.
Sourcepub fn get_global_setting(&self, key: &str) -> Option<&str>
pub fn get_global_setting(&self, key: &str) -> Option<&str>
Gets a global setting.
Sourcepub fn set_global_setting(&mut self, key: String, value: String)
pub fn set_global_setting(&mut self, key: String, value: String)
Sets a global setting.
Sourcepub fn get_settings_for(
&self,
printer_id: &str,
backend: &str,
) -> HashMap<String, String>
pub fn get_settings_for( &self, printer_id: &str, backend: &str, ) -> HashMap<String, String>
Gets the merged settings for a specific printer.
This combines the global_settings with the printer-specific settings,
where printer-specific values override global values.
Sourcepub fn set_settings_for(
&mut self,
printer_id: &str,
backend: &str,
settings: HashMap<String, String>,
)
pub fn set_settings_for( &mut self, printer_id: &str, backend: &str, settings: HashMap<String, String>, )
Updates or replaces the settings for a specific printer.
Sourcepub fn set_setting_for(
&mut self,
printer_id: &str,
backend: &str,
key: String,
value: String,
)
pub fn set_setting_for( &mut self, printer_id: &str, backend: &str, key: String, value: String, )
Sets or updates a single setting for a specific printer.
Sourcepub fn get_setting_for(
&self,
printer_id: &str,
backend: &str,
key: &str,
) -> Option<&str>
pub fn get_setting_for( &self, printer_id: &str, backend: &str, key: &str, ) -> Option<&str>
Gets a specific setting for a printer (printer-specific or global fallback).
Sourcepub fn remove_settings_for(&mut self, printer_id: &str, backend: &str)
pub fn remove_settings_for(&mut self, printer_id: &str, backend: &str)
Removes all printer-specific settings stored for a printer.
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 moreSource§impl Debug for PrinterConfig
impl Debug for PrinterConfig
Source§impl Default for PrinterConfig
impl Default for PrinterConfig
Source§fn default() -> PrinterConfig
fn default() -> PrinterConfig
Source§impl<'de> Deserialize<'de> for PrinterConfig
impl<'de> Deserialize<'de> for PrinterConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for PrinterConfig
impl PartialEq for PrinterConfig
Source§fn eq(&self, other: &PrinterConfig) -> bool
fn eq(&self, other: &PrinterConfig) -> bool
self and other values to be equal, and is used by ==.