Crate printer_event_handler

Source
Expand description

§Printer Event Handler

A cross-platform printer status monitoring library for Windows and Linux systems. This library provides functionality to query printer status, monitor printer events, and track printer state changes using platform-specific backends:

  • Windows: WMI (Windows Management Instrumentation)
  • Linux: CUPS (Common Unix Printing System)

§Features

  • Cross-platform support (Windows and Linux)
  • Query all printers on the system
  • Monitor specific printers for status changes
  • Async/await support with Tokio
  • Detailed printer status and error state information
  • Platform-specific backends with unified API

§Example

use printer_event_handler::{PrinterMonitor, PrinterError};

#[tokio::main]
async fn main() -> Result<(), PrinterError> {
    let monitor = PrinterMonitor::new().await?;
     
    // List all printers
    let printers = monitor.list_printers().await?;
    for printer in printers {
        println!("Printer: {}", printer.name());
        println!("Status: {}", printer.status_description());
    }
     
    Ok(())
}

Re-exports§

pub use error::PrinterError;
pub use monitor::PrinterMonitor;
pub use printer::ErrorState;
pub use printer::Printer;
pub use printer::PrinterStatus;

Modules§

backend
error
monitor
printer

Type Aliases§

Result
Result type used throughout the library