pub struct DaemonIdentity { /* private fields */ }Expand description
A client’s typed view of the daemon it is connected to.
The pre-capability value — DaemonIdentity::pre_capability
— is not an error state and is not a fallback bolted on the side.
It is what every client gets today, because the daemon running on
this machine predates the probe. Treat it as the normal case.
Implementations§
Source§impl DaemonIdentity
impl DaemonIdentity
Sourcepub fn pre_capability() -> Self
pub fn pre_capability() -> Self
A daemon that could not answer Request::Hello: it predates
the probe (or refused it). Protocol 0 — no capabilities.
Sourcepub fn from_hello(hello: DaemonHello) -> Self
pub fn from_hello(hello: DaemonHello) -> Self
Build from a daemon’s hello reply.
Sourcepub fn local(version: &str) -> Self
pub fn local(version: &str) -> Self
The identity an in-process backend has: it is this build, so it implements exactly what this build advertises.
Sourcepub fn version(&self) -> Option<&str>
pub fn version(&self) -> Option<&str>
The daemon’s own version, or None when it predates the
probe. Never fall back to the client’s version here — that
substitution is precisely the lie tear status used to tell.
Sourcepub fn is_pre_capability(&self) -> bool
pub fn is_pre_capability(&self) -> bool
True when the daemon could not answer the probe at all.
Sourcepub fn capability_names(&self) -> Vec<&str>
pub fn capability_names(&self) -> Vec<&str>
Wire names, sorted. Includes names this build cannot type.
Sourcepub fn has(&self, cap: Capability) -> bool
pub fn has(&self, cap: Capability) -> bool
Does the daemon implement cap?
Sourcepub fn require(&self, cap: Capability, detail: &str) -> ControlResult<()>
pub fn require(&self, cap: Capability, detail: &str) -> ControlResult<()>
Typed refusal for a call that needs cap.
Call this only on the branch that actually requires the
capability — a caller who passes no args must not be
refused by a daemon that cannot read args. That
call-site-scoped shape is the whole point: the refusal is
about one field, not a global “you are old” banner.
§Errors
ControlError::Unsupported naming the capability, the
daemon’s version (or that it predates the probe), and what
to do about it.
Trait Implementations§
Source§impl Clone for DaemonIdentity
impl Clone for DaemonIdentity
Source§fn clone(&self) -> DaemonIdentity
fn clone(&self) -> DaemonIdentity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more