Skip to main content

discover_one

Function discover_one 

Source
pub async fn discover_one<F>(
    mdns: &MdnsService,
    query: &str,
    service_name: &str,
    timeout: Duration,
    predicate: F,
) -> Result<(String, MatterDeviceInfo)>
where F: Fn(&str, &MatterDeviceInfo) -> bool,
Expand description

Discover the first device matching a predicate.

Subscribes to the broadcast channel, sends query as an active mDNS lookup, then drains events until one matching service_name passes predicate. Lag events (dropped due to buffer overflow) are logged and skipped; discovery continues normally.

predicate receives the full instance target string and the parsed MatterDeviceInfo.