pub struct ServiceHandle { /* private fields */ }Expand description
The running service. Dropping it shuts the service down, so a shell can simply hold it for as long as devtools should be available.
Implementations§
Source§impl ServiceHandle
impl ServiceHandle
Sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
The bound loopback port — always ephemeral, so this is the only way to know it besides the discovery line.
Sourcepub fn token(&self) -> Option<&str>
pub fn token(&self) -> Option<&str>
This process’s handshake token, or None when the service was started
with ServiceConfig::require_token off.
The in-process counterpart of reading it off the discovery line, and no weaker: the caller is the process that owns the secret. Handing it anywhere else — a response body, a file, another process — defeats the whole mechanism, which relies on the token reaching only readers of this app’s log stream.
Sourcepub fn publish_frame_stats(&self, stats: FrameStats)
pub fn publish_frame_stats(&self, stats: FrameStats)
Publishes one frame’s stats to every subscribed client.
Safe to call from the frame thread: it writes one value into a
preallocated bounded ring and returns — it never waits on a client, on
the network, or on a full queue, and it cannot fail. With no
subscribers it is very nearly free. A client that cannot keep up loses
the oldest queued frames (crate::frame_stats), which is the whole
reason this cannot stall the producer — docs/REVIEW_FOCUS.md rates a
parking call on the UI thread critical.
Sourcepub fn shutdown(self)
pub fn shutdown(self)
Stops accepting, closes live connections, and joins the service thread.
The backend thread is deliberately not joined: it may be parked inside a shell call on a frozen UI thread, and shutdown must not be hostage to that. It exits on its own once the last connection drops the channel.