#[non_exhaustive]pub struct BrokerConfig {
pub mode: Option<BrokerMode>,
pub url: Option<BrokerEndpoint>,
pub wanted: Option<Wanted>,
pub tls: bool,
pub accept: Option<Vec<BrokerType>>,
pub allow_unmatched: bool,
pub settle_ms: u64,
pub fallback_after_ms: u64,
}alloc only.Expand description
How a host finds its broker, from its defaults overridden by its REST “MQTT broker configuration” (framework.md:93, 607).
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.mode: Option<BrokerMode>The broker mode; None: ConfiguredOnly with a URL, else DiscoveryOnly.
url: Option<BrokerEndpoint>The configured broker.
wanted: Option<Wanted>The particular discovered broker wanted; not with a URL.
tls: boolTLS required; also implied by an mqtts:// URL.
accept: Option<Vec<BrokerType>>The accepted broker types in the client’s preference order, most
preferred first; a type listed twice keeps its first position. None:
[SecureMqtt] with TLS, else TCP_BROKER_TYPES, both in the
specification’s order. A list is used as given whatever tls says, so
a TLS client listing a plain type can select a plain broker.
allow_unmatched: boolIn DiscoveryWithFallback with a URL, accept a discovered broker that
does not match it (ebus.py:776-781).
settle_ms: u64How long after the first usable broker is seen the result is set.
fallback_after_ms: u64In DiscoveryWithFallback with a URL, how long after the start the
configured broker is used when no discovered broker matched.
Implementations§
Source§impl BrokerConfig
impl BrokerConfig
Sourcepub fn effective_mode(&self) -> BrokerMode
pub fn effective_mode(&self) -> BrokerMode
The mode in effect: mode, else ConfiguredOnly with a URL, else
DiscoveryOnly.
Sourcepub fn requires_tls(&self) -> bool
pub fn requires_tls(&self) -> bool
True when TLS is required: tls, or a TLS URL.
Sourcepub fn accepted(&self) -> Vec<BrokerType>
pub fn accepted(&self) -> Vec<BrokerType>
The broker types accepted, most preferred first: accept without
repeats, else _secure-mqtt._tcp alone when TLS is required, else
TCP_BROKER_TYPES (_mdns_core.py:247-253).
Sourcepub fn check(&self) -> Result<(), BrokerConfigError>
pub fn check(&self) -> Result<(), BrokerConfigError>
The configuration errors BrokerSearch::new rejects.
Sourcepub fn rank(
&self,
endpoints: impl IntoIterator<Item = BrokerEndpoint>,
) -> Vec<BrokerEndpoint>
pub fn rank( &self, endpoints: impl IntoIterator<Item = BrokerEndpoint>, ) -> Vec<BrokerEndpoint>
The accepted brokers among endpoints, with wanted applied, ranked
in the accepted order. endpoints is every broker
endpoint seen, of every type: Wanted::DeviceId reads the
device_id of endpoints whose type is not accepted too.