pub struct FilePrinterDevice<T: FilePrinterProvider> { /* private fields */ }Expand description
A virtual “print-to-file” printer device backed by a built-in Windows driver.
Each instance installs a freshly-created printer port (a unique temp file) and a printer
using the driver supplied by T. Dropping the value removes the printer, the port, and the
backing temp file. Unlike null_device, this type is not thread-local or shared ? each
FilePrinterDevice owns its own printer; if you need several, construct several.
use winprint_ext::test_utils::file_device::{FilePrinterDevice, PwgRaster};
let dev = FilePrinterDevice::<PwgRaster>::new().unwrap();
println!("printer: {}", dev.device().name());
println!("output: {}", dev.file_path().display());
// ... use dev.device() for printing ...Implementations§
Source§impl<T: FilePrinterProvider> FilePrinterDevice<T>
impl<T: FilePrinterProvider> FilePrinterDevice<T>
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new virtual “print-to-file” printer.
On first call per-process (per driver) this installs the driver and cleans up leftover printers from previous crashed runs. Subsequent calls only create the port and printer.
Sourcepub fn device(&self) -> &PrinterDevice
pub fn device(&self) -> &PrinterDevice
Returns the underlying PrinterDevice.
Trait Implementations§
Source§impl<T: FilePrinterProvider> Drop for FilePrinterDevice<T>
impl<T: FilePrinterProvider> Drop for FilePrinterDevice<T>
Auto Trait Implementations§
impl<T> Freeze for FilePrinterDevice<T>
impl<T> RefUnwindSafe for FilePrinterDevice<T>
impl<T> Send for FilePrinterDevice<T>
impl<T> Sync for FilePrinterDevice<T>
impl<T> Unpin for FilePrinterDevice<T>
impl<T> UnsafeUnpin for FilePrinterDevice<T>
impl<T> UnwindSafe for FilePrinterDevice<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more