Skip to main content

PrintBackendProxy

Struct PrintBackendProxy 

Source
pub struct PrintBackendProxy<'p>(/* private fields */);
Available on crate feature zbus-backend only.
Expand description

Low-level proxy for org.openprinting.PrintBackend.

Prefer CpdbClient for high-level usage.

Implementations§

Source§

impl<'p> PrintBackendProxy<'p>

Source

pub async fn new(conn: &Connection) -> Result<PrintBackendProxy<'p>>

Creates a new proxy with the default service and path.

Source

pub fn builder(conn: &Connection) -> Builder<'p, Self>

Returns a customizable builder for this proxy.

Source

pub fn into_inner(self) -> Proxy<'p>

Consumes self, returning the underlying zbus::Proxy.

Source

pub fn inner(&self) -> &Proxy<'p>

The reference to the underlying zbus::Proxy.

Source

pub fn inner_mut(&mut self) -> &mut Proxy<'p>

The mutable reference to the underlying zbus::Proxy.

Source

pub async fn get_all_printers(&self) -> Result<(i32, Vec<(OwnedValue,)>)>

Returns all printers known to this backend.

Source

pub async fn get_backend_name(&self) -> Result<String>

Returns the backend name (e.g. “CUPS”, “FILE”).

Source

pub async fn get_filtered_printer_list( &self, ) -> Result<(i32, Vec<(OwnedValue,)>)>

Returns printers matching the current filter settings.

Source

pub async fn do_listing(&self, is_listed: bool) -> Result<()>

Starts or stops printer discovery. Call do_listing(true) to trigger PrinterAdded signals for all known printers.

This is a fire-and-forget method - the backend does not send a reply.

Source

pub async fn get_all_options( &self, printer_id: &str, ) -> Result<(i32, Vec<RawOption>, i32, Vec<RawMedia>)>

Fetches all options and media for a printer in a single call.

Returns (num_options, options, num_media, media). This is the primary method for getting printer capabilities.

Source

pub async fn get_all_translations( &self, printer_id: &str, locale: &str, ) -> Result<HashMap<String, String>>

Fetches all localized translations for a printer’s options.

Returns a map of internal name -> human-readable label.

Source

pub async fn get_default_printer(&self) -> Result<String>

Returns the default printer ID for this backend.

Source

pub async fn get_printer_state(&self, printer_id: &str) -> Result<String>

Returns the current state of a printer (e.g. “idle”, “printing”).

Source

pub async fn is_accepting_jobs(&self, printer_id: &str) -> Result<bool>

Returns whether a printer is currently accepting jobs.

Source

pub async fn get_option_translation( &self, printer_name: &str, option_name: &str, locale: &str, ) -> Result<String>

Returns a localized label for a single option name.

Source

pub async fn get_choice_translation( &self, printer_name: &str, option_name: &str, choice_name: &str, locale: &str, ) -> Result<String>

Returns a localized label for a single option choice.

Source

pub async fn get_group_translation( &self, printer_name: &str, group_name: &str, locale: &str, ) -> Result<String>

Returns a localized label for an option group.

Source

pub async fn print_fd( &self, printer_id: &str, num_settings: i32, settings: &[(&str, &str)], title: &str, ) -> Result<(String, OwnedFd)>

Submits a print job and returns a writable file descriptor.

The backend creates a job and returns the write end of a socketpair. The caller writes document data into fd and closes it when done.

Source

pub async fn print_socket( &self, printer_id: &str, num_settings: i32, settings: &[(&str, &str)], title: &str, ) -> Result<(String, String)>

Submits a print job via a Unix socket path.

Source

pub async fn show_remote_printers(&self, is_visible: bool) -> Result<()>

Show or hide remote (network-discovered) printers.

This is a fire-and-forget method. The backend will emit PrinterRemoved or PrinterAdded signals to reflect the new filtered state.

Source

pub async fn show_temporary_printers(&self, is_visible: bool) -> Result<()>

Show or hide temporary (auto-discovered) printers.

Source

pub async fn keep_alive(&self) -> Result<()>

Keeps the backend alive (prevents auto-exit timeout).

Source

pub async fn replace(&self, previous_dialog_id: &str) -> Result<()>

Tells the backend to replace state from a previous dialog session.

Source

pub async fn ping(&self, printer_id: &str) -> Result<()>

Ping (testing only, will be removed from spec).

Source

pub async fn receive_printer_added(&self) -> Result<PrinterAddedStream>

Create a stream that receives PrinterAdded signals.

This a convenient wrapper around zbus::Proxy::receive_signal. Emitted when a new printer is discovered by this backend.

Source

pub async fn receive_printer_added_with_args( &self, args: &[(u8, &str)], ) -> Result<PrinterAddedStream>

Create a stream that receives PrinterAdded signals.

This a convenient wrapper around zbus::Proxy::receive_signal_with_args. Emitted when a new printer is discovered by this backend.

Source

pub async fn receive_printer_removed(&self) -> Result<PrinterRemovedStream>

Create a stream that receives PrinterRemoved signals.

This a convenient wrapper around zbus::Proxy::receive_signal. Emitted when a printer is removed from this backend.

Source

pub async fn receive_printer_removed_with_args( &self, args: &[(u8, &str)], ) -> Result<PrinterRemovedStream>

Create a stream that receives PrinterRemoved signals.

This a convenient wrapper around zbus::Proxy::receive_signal_with_args. Emitted when a printer is removed from this backend.

Source

pub async fn receive_printer_state_changed( &self, ) -> Result<PrinterStateChangedStream>

Create a stream that receives PrinterStateChanged signals.

This a convenient wrapper around zbus::Proxy::receive_signal. Emitted when a printer’s state changes (e.g. idle -> printing).

Source

pub async fn receive_printer_state_changed_with_args( &self, args: &[(u8, &str)], ) -> Result<PrinterStateChangedStream>

Create a stream that receives PrinterStateChanged signals.

This a convenient wrapper around zbus::Proxy::receive_signal_with_args. Emitted when a printer’s state changes (e.g. idle -> printing).

Trait Implementations§

Source§

impl<'p> AsMut<Proxy<'p>> for PrintBackendProxy<'p>

Source§

fn as_mut(&mut self) -> &mut Proxy<'p>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<'p> AsRef<Proxy<'p>> for PrintBackendProxy<'p>

Source§

fn as_ref(&self) -> &Proxy<'p>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'p> Clone for PrintBackendProxy<'p>

Source§

fn clone(&self) -> PrintBackendProxy<'p>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'p> Debug for PrintBackendProxy<'p>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Defaults for PrintBackendProxy<'a>

Source§

const INTERFACE: &'static Option<InterfaceName<'static>>

Source§

const DESTINATION: &'static Option<BusName<'static>>

Source§

const PATH: &'static Option<ObjectPath<'static>>

Source§

impl<'p> From<Proxy<'p>> for PrintBackendProxy<'p>

Source§

fn from(proxy: Proxy<'p>) -> Self

Converts to this type from the input type.
Source§

impl<'p> ProxyImpl<'p> for PrintBackendProxy<'p>

Source§

fn builder(conn: &Connection) -> Builder<'p, Self>

Return a customizable builder for this proxy.
Source§

fn into_inner(self) -> Proxy<'p>

Consume self, returning the underlying zbus::Proxy.
Source§

fn inner(&self) -> &Proxy<'p>

The reference to the underlying zbus::Proxy.
Source§

impl<'p> Serialize for PrintBackendProxy<'p>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'p> Type for PrintBackendProxy<'p>

Source§

const SIGNATURE: &'static Signature

The signature for the implementing type, in parsed format. Read more

Auto Trait Implementations§

§

impl<'p> !RefUnwindSafe for PrintBackendProxy<'p>

§

impl<'p> !UnwindSafe for PrintBackendProxy<'p>

§

impl<'p> Freeze for PrintBackendProxy<'p>

§

impl<'p> Send for PrintBackendProxy<'p>

§

impl<'p> Sync for PrintBackendProxy<'p>

§

impl<'p> Unpin for PrintBackendProxy<'p>

§

impl<'p> UnsafeUnpin for PrintBackendProxy<'p>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynamicType for T
where T: Type + ?Sized,

Source§

fn signature(&self) -> Signature

The type signature for self. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more