Skip to main content

parse_discovery_line

Function parse_discovery_line 

Source
pub fn parse_discovery_line(line: &str) -> Option<Discovery>
Expand description

Finds DISCOVERY_PREFIX anywhere in line — a substring search, not a line-start anchor — and parses the port (and optional token) that follow it.

Substring (not anchored) search is deliberate: a host logger commonly prepends its own prefix before app output reaches it (Android logcat’s MM-DD HH:MM:SS.mmm PID TID L Tag: , a desktop process supervisor’s timestamp, …), so tooling must find the marker wherever it lands in the line, not only at column 0.

Returns None if the prefix is absent, or is not immediately followed by at least one digit. A line with no token — or with the marker but nothing after it — still yields its port, with token: None.