pub struct BridgeStatus {
pub engagement: BridgeEngagement,
pub proxy_running: bool,
pub proxy_configured: bool,
pub total_requests: u64,
pub tool_count: usize,
}Expand description
Snapshot of the bridge state used to explain gain’s savings numbers.
Fields§
§engagement: BridgeEngagement§proxy_running: bool§proxy_configured: boolWhether the proxy is enabled in config at all (proxy_enabled = true).
total_requests: u64Cumulative LLM requests the proxy has intercepted (within the freshness
window). 0 means the bridge has not seen compressible traffic.
tool_count: usizeNumber of MCP tools the registry exposes — the /lean-ctx tool-count.
Implementations§
Source§impl BridgeStatus
impl BridgeStatus
Sourcepub fn detect() -> Self
pub fn detect() -> Self
Check the configured proxy endpoint and persisted introspection data to
determine whether the bridge is engaged. Uses the same source of truth as
doctor: the proxy must be enabled in config and answer as lean-ctx (a
foreign process on the port does not count). Never panics: every signal
degrades to a conservative default (proxy down / 0 requests) on error.
Sourcepub fn summary_line(&self) -> String
pub fn summary_line(&self) -> String
One-line /lean-ctx-style status shown above the savings numbers so the
precondition for savings (bridge connected + tool-count) is always
explicit.
Sourcepub fn zero_savings_reason(&self, tokens_saved: u64) -> Option<String>
pub fn zero_savings_reason(&self, tokens_saved: u64) -> Option<String>
Explanation for a reported 0 saved, distinguishing “bridge off” from a
genuine zero. Returns None when savings are non-zero (no hint needed).
Trait Implementations§
Source§impl Clone for BridgeStatus
impl Clone for BridgeStatus
Source§impl Debug for BridgeStatus
impl Debug for BridgeStatus
Auto Trait Implementations§
impl Forget for BridgeStatus
impl Freeze for BridgeStatus
impl Move for BridgeStatus
impl RefUnwindSafe for BridgeStatus
impl Send for BridgeStatus
impl Sync for BridgeStatus
impl Unpin for BridgeStatus
impl UnsafeUnpin for BridgeStatus
impl UnwindSafe for BridgeStatus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more