Skip to main content

DaemonIdentity

Struct DaemonIdentity 

Source
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

Source

pub fn pre_capability() -> Self

A daemon that could not answer Request::Hello: it predates the probe (or refused it). Protocol 0 — no capabilities.

Source

pub fn from_hello(hello: DaemonHello) -> Self

Build from a daemon’s hello reply.

Source

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.

Source

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.

Source

pub fn is_pre_capability(&self) -> bool

True when the daemon could not answer the probe at all.

Source

pub fn capability_names(&self) -> Vec<&str>

Wire names, sorted. Includes names this build cannot type.

Source

pub fn has(&self, cap: Capability) -> bool

Does the daemon implement cap?

Source

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

Source§

fn clone(&self) -> DaemonIdentity

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DaemonIdentity

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DaemonIdentity

Source§

fn default() -> DaemonIdentity

Returns the “default value” for a type. Read more
Source§

impl Eq for DaemonIdentity

Source§

impl PartialEq for DaemonIdentity

Source§

fn eq(&self, other: &DaemonIdentity) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DaemonIdentity

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.