pub struct Client { /* private fields */ }Expand description
Dialer pinned at a socket path. Cheap to construct; the
actual UnixStream is opened per-request.
Implementations§
Source§impl Client
impl Client
pub fn new(socket_path: impl Into<PathBuf>) -> Self
Sourcepub fn with_timeout(self, t: Duration) -> Self
pub fn with_timeout(self, t: Duration) -> Self
Override the per-request timeout. Tests rely on this to distinguish “daemon down” from “daemon slow”.
pub fn socket_path(&self) -> &Path
Sourcepub fn socket_exists(&self) -> bool
pub fn socket_exists(&self) -> bool
Returns true if the socket file exists. Not a
liveness check — a stale socket (daemon crashed
without cleanup) will still return true and the next
Self::send will surface the real failure mode.
Sourcepub async fn send(&self, req: &Request) -> Result<Response, ClientError>
pub async fn send(&self, req: &Request) -> Result<Response, ClientError>
Send a single request and wait for a single reply. All
I/O is bounded by Self::with_timeout.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Client
impl Freeze for Client
impl Move for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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
Mutably borrows from an owned value. Read more