#[non_exhaustive]pub struct Advertisement {
pub identity: Identity,
pub instance: Option<String>,
pub ebus_port: Option<u16>,
pub device_info_port: u16,
pub http: Vec<HttpService>,
pub brokers: Vec<BrokerService>,
}alloc only.Expand description
Everything a host advertises, all under one instance name.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.identity: IdentityThe identity.
instance: Option<String>The instance name; None for the default rule (Advertisement::instance_names).
ebus_port: Option<u16>The _ebus._tcp port; None for the first REST API’s port, else 0.
device_info_port: u16The _device-info._tcp port, 0 by default.
http: Vec<HttpService>REST APIs.
brokers: Vec<BrokerService>Brokers, at most one per type.
Implementations§
Source§impl Advertisement
impl Advertisement
Sourcepub fn new(identity: Identity) -> Self
pub fn new(identity: Identity) -> Self
The identity’s _ebus._tcp and _device-info._tcp records alone.
Sourcepub fn http(self, http: HttpService) -> Self
pub fn http(self, http: HttpService) -> Self
With a REST API added.
Sourcepub fn broker(self, broker: BrokerService) -> Self
pub fn broker(self, broker: BrokerService) -> Self
With a broker added.
Sourcepub fn records(&self, server: &str) -> Result<Vec<ServiceRecord>, TxtError>
pub fn records(&self, server: &str) -> Result<Vec<ServiceRecord>, TxtError>
Every record, in python’s order (_mdns_core.py:900-939): _ebus._tcp,
_device-info._tcp, the REST APIs, then the brokers. server is the
SRV target, the default TXT broker. Every record is checked with
check_txt; brokers without the broker-host role are logged with
reason=brokersWithoutBrokerHostRole and roles is left as given.
Sourcepub fn base_instance_name(&self, server: &str) -> String
pub fn base_instance_name(&self, server: &str) -> String
The instance name all records share: the explicit name, else the first
device id when it fits MAX_DEFAULT_INSTANCE_OCTETS, else the host
label of server, logged with reason=deviceIdTooLongForInstanceName
(_mdns_core.py:1129-1152).
Sourcepub fn instance_names(
&self,
server: &str,
) -> impl Iterator<Item = String> + use<>
pub fn instance_names( &self, server: &str, ) -> impl Iterator<Item = String> + use<>
The instance names to try in turn: the base name
(Advertisement::base_instance_name), then -2 through -99
(_mdns_core.py:937-939).