pub struct UnixSocketClient { /* private fields */ }Expand description
Async JSON-RPC 2.0 NDJSON client for communicating with the daemon over a Unix Domain Socket.
Implementations§
Source§impl UnixSocketClient
impl UnixSocketClient
Sourcepub async fn connect<P: AsRef<Path>>(socket_path: P) -> Result<Self>
pub async fn connect<P: AsRef<Path>>(socket_path: P) -> Result<Self>
Connects to the daemon at socket_path.
Sourcepub async fn call(
&mut self,
method: impl Into<String>,
params: Option<Value>,
) -> Result<RpcResponse>
pub async fn call( &mut self, method: impl Into<String>, params: Option<Value>, ) -> Result<RpcResponse>
Sends a JSON-RPC 2.0 request with an auto-incremented numeric id and awaits the response.
Sourcepub async fn notify(
&mut self,
method: impl Into<String>,
params: Option<Value>,
) -> Result<()>
pub async fn notify( &mut self, method: impl Into<String>, params: Option<Value>, ) -> Result<()>
Sends a JSON-RPC 2.0 notification (no id; daemon does not send a reply).
Sourcepub async fn send_raw_line(&mut self, raw: &str) -> Result<RpcResponse>
pub async fn send_raw_line(&mut self, raw: &str) -> Result<RpcResponse>
Sends a raw NDJSON line and reads back one RpcResponse line (handy for testing protocol errors).
Sourcepub async fn ping(&mut self) -> Result<()>
pub async fn ping(&mut self) -> Result<()>
Sends a "ping" request and verifies the daemon responds with "pong".
Sourcepub async fn search(
&mut self,
query: impl Into<String>,
limit: u32,
) -> Result<SearchResultPayload>
pub async fn search( &mut self, query: impl Into<String>, limit: u32, ) -> Result<SearchResultPayload>
Queries the daemon for up to limit fuzzy matches.
Sourcepub async fn exec(
&mut self,
id: impl Into<String>,
execute: bool,
) -> Result<ExecResultPayload>
pub async fn exec( &mut self, id: impl Into<String>, execute: bool, ) -> Result<ExecResultPayload>
Triggers execution (or frecency-only recording) for an entry ID.
Sourcepub async fn reload(&mut self) -> Result<ReloadResultPayload>
pub async fn reload(&mut self) -> Result<ReloadResultPayload>
Triggers an index reload on the daemon and returns the new entry count.
Auto Trait Implementations§
impl Forget for UnixSocketClient
impl Freeze for UnixSocketClientwhere
*const ArcInner<UnixStream> is !null: Freeze,
PhantomData<ArcInner<UnixStream>>: Freeze,
*const [u8] is !null: Freeze,
PhantomData<[u8]>: Freeze,
impl Move for UnixSocketClient
impl RefUnwindSafe for UnixSocketClient
impl Send for UnixSocketClient
impl Sync for UnixSocketClient
impl Unpin for UnixSocketClient
impl UnsafeUnpin for UnixSocketClientwhere
*const ArcInner<UnixStream> is !null: UnsafeUnpin,
PhantomData<ArcInner<UnixStream>>: UnsafeUnpin,
*const [u8] is !null: UnsafeUnpin,
PhantomData<[u8]>: UnsafeUnpin,
impl UnwindSafe for UnixSocketClient
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
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> ⓘ
Converts
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> ⓘ
Converts
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