pub struct DaemonClient { /* private fields */ }Expand description
A one-shot client over the daemon’s Unix-domain control socket. Each call
opens a fresh connection, sends one DaemonEnvelope, and reads one
DaemonReply.
Implementations§
Source§impl DaemonClient
impl DaemonClient
Sourcepub fn new(socket_path: impl Into<PathBuf>) -> Self
pub fn new(socket_path: impl Into<PathBuf>) -> Self
Creates a client targeting the socket at socket_path.
Sourcepub fn socket_path(&self) -> &Path
pub fn socket_path(&self) -> &Path
The socket path this client targets.
Sourcepub async fn request(&self, envelope: DaemonEnvelope) -> Result<DaemonReply>
pub async fn request(&self, envelope: DaemonEnvelope) -> Result<DaemonReply>
Sends one envelope and returns the daemon’s reply.
Sourcepub async fn subscribe(
&self,
envelope: DaemonEnvelope,
) -> Result<DaemonSubscription>
pub async fn subscribe( &self, envelope: DaemonEnvelope, ) -> Result<DaemonSubscription>
Opens a streaming subscription: sends envelope once and returns a
handle over which the daemon pushes many replies on the same
connection (an initial snapshot then a fresh one on each change) until the
daemon or the client closes it. Per the control-socket protocol the client
must only read after this — sending any further line is interpreted as an
explicit cancel — so DaemonSubscription exposes reads only.
Sourcepub async fn ping(&self) -> Result<()>
pub async fn ping(&self) -> Result<()>
Probes whether a live daemon is answering on the socket.
Sourcepub async fn version(&self) -> Result<Option<String>>
pub async fn version(&self) -> Result<Option<String>>
Returns the resident daemon’s advertised binary version, or None when it
advertises none (a pre-#1113 daemon whose ping carries no version).
Lets a client warn that it is driving a stale daemon after a binary
upgrade without a separate status round-trip.
Sourcepub async fn status(&self) -> Result<StatusReport>
pub async fn status(&self) -> Result<StatusReport>
Requests aggregated per-service status.
Trait Implementations§
Source§impl Clone for DaemonClient
impl Clone for DaemonClient
Source§fn clone(&self) -> DaemonClient
fn clone(&self) -> DaemonClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DaemonClient
impl RefUnwindSafe for DaemonClient
impl Send for DaemonClient
impl Sync for DaemonClient
impl Unpin for DaemonClient
impl UnsafeUnpin for DaemonClient
impl UnwindSafe for DaemonClient
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<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