pub enum ReportedBinding {
Projectless,
Bound(PathBuf),
Unreported,
}Expand description
The project binding a live daemon published on GET /health (#4512).
Why: a tcode serve --http daemon binds exactly ONE ProjectBinding at
crate::serve::build_router time and keeps it for its whole life. Until
#4512 that binding was invisible to clients, which was harmless while
tcode tui refused to run without a hand-started daemon — the operator
who started it knew what it was bound to. Auto-attach removes that
guarantee: a TUI launched in project B finds project A’s daemon on the
well-known port and would drive it, so every session, index, and file
operation would silently land in the wrong project. Making the binding
part of the lookup result is what lets a caller refuse.
What: the daemon’s bound project root, or an explicit projectless state,
or Unreported when /health answered but
carried no usable binding field — a daemon older than #4512, or one
whose payload could not be parsed. Those two are deliberately the same
variant: both mean “this daemon’s project CANNOT be verified”, and a
caller must treat an unverifiable daemon the same way regardless of why.
Test: discovery_tests::reported_binding_parses_every_health_shape.
Variants§
Projectless
The daemon reported it serves no project.
Bound(PathBuf)
The daemon reported this canonical project root.
Unreported
/health answered, but with no parseable binding field.
Implementations§
Source§impl ReportedBinding
impl ReportedBinding
Sourcepub fn from_health(health: &Value) -> Self
pub fn from_health(health: &Value) -> Self
Read a ReportedBinding out of a GET /health body.
Why/What: reuses ProjectBinding’s own Deserialize (the
{state, root} wire shape defined once in crate::binding) rather
than re-spelling that shape here, so the reader can never drift from
the writer. A missing or malformed field is
Unreported, never a guess.
Test: discovery_tests::reported_binding_parses_every_health_shape.
Trait Implementations§
Source§impl Clone for ReportedBinding
impl Clone for ReportedBinding
Source§fn clone(&self) -> ReportedBinding
fn clone(&self) -> ReportedBinding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReportedBinding
impl Debug for ReportedBinding
impl Eq for ReportedBinding
Source§impl PartialEq for ReportedBinding
impl PartialEq for ReportedBinding
impl StructuralPartialEq for ReportedBinding
Auto Trait Implementations§
impl Freeze for ReportedBinding
impl RefUnwindSafe for ReportedBinding
impl Send for ReportedBinding
impl Sync for ReportedBinding
impl Unpin for ReportedBinding
impl UnsafeUnpin for ReportedBinding
impl UnwindSafe for ReportedBinding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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