Skip to main content

AdvertiserControl

Trait AdvertiserControl 

Source
pub trait AdvertiserControl: Send + Sync {
    // Required methods
    fn publish(&self, rec: &PrinterRecord);
    fn withdraw(&self, name: &str);
    fn is_advertised(&self, name: &str) -> bool;
}
Expand description

Lets the status poller pull a printer out of DNS-SD discovery when its device goes offline, and republish it when the device returns — so a powered-off printer stops showing up in print dialogs. Implemented by crate::mdns::Advertiser; the poller holds it as a trait object so the poller stays independent of the optional mdns feature.

Required Methods§

Source

fn publish(&self, rec: &PrinterRecord)

Republish the printer’s discovery advert (its device came back online). Idempotent: a no-op if already advertised.

Source

fn withdraw(&self, name: &str)

Withdraw the printer’s discovery advert (its device went offline). Idempotent: a no-op if not currently advertised.

Source

fn is_advertised(&self, name: &str) -> bool

Whether this printer is currently advertised.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§