Expand description
Safe wrapper around cpdb_printer_obj_t.
§Ownership and lifetimes
Printers come in two flavours:
- Borrowed — returned by [
crate::Frontend::find_printer], [crate::Frontend::get_printer], [crate::Frontend::get_printers], and the default-printer accessors. The underlying C object is owned by the frontend’s hash table; the Rust binding carries the frontend’s lifetime so the borrow checker enforces that the printer cannot outlive its frontend. - Owned — returned by
Printer::load_from_file. The C object was allocated independently; Rust frees it viacpdbDeletePrinterObjon drop. Owned printers have a'staticlifetime.
Printer deliberately does not implement Send or Sync. Most
cpdb-libs methods on a printer object mutate shared state (the printer’s
settings table is shared with the frontend), and the C library does not
lock internally. If you need to dispatch printer operations from
multiple threads, wrap a single printer in a std::sync::Mutex.
Structs§
- Margin
- Page margins in hundredths of a millimetre.
- Margins
- One or more
Marginentries returned by the backend for a media type. - Media
Size - Media dimensions in hundredths of a millimetre.
- Print
FdHandle - Handle returned by
Printer::print_fd. - Print
Socket Handle - Handle returned by
Printer::print_socket. - Printer
- A safe handle to a cpdb printer object.
- Translation
Map - An owned snapshot of a printer’s translation table.