pub struct EverythingClient { /* private fields */ }Expand description
Everything IPC client
See wm for details.
Implementations§
Source§impl EverythingClient
impl EverythingClient
Get a globally-shared, lazily-created EverythingClient.
The first call creates and returns an Arc-wrapped client. Subsequent
calls return a clone of the same Arc. When all returned Arcs are
dropped, the underlying client (and its reply window thread) is dropped.
A new client is automatically created on the next call.
§Note
EverythingClient::query() will cancel the previous query.
Use with caution.
Quit and join the message thread of the last shared client instance.
This function is meant to manually make sure the thread is exited before DLL unloading.
While drop-join-thread feature also works for statics,
it will break thread_locals.
§Safety
This function is !Sync. It’s unlikely that you need Sync though.
Source§impl EverythingClient
impl EverythingClient
Sourcepub fn get_folder_size<'f1, 'f2>(
&'f1 self,
path: &'f2 Path,
) -> EverythingClientGetFolderSizeBuilder<'f1, 'f2>
pub fn get_folder_size<'f1, 'f2>( &'f1 self, path: &'f2 Path, ) -> EverythingClientGetFolderSizeBuilder<'f1, 'f2>
A convenient query wrapper that get the size of a folder.
See also folder::size.
Source§impl EverythingClient
impl EverythingClient
Sourcepub fn query<'f1, 'f2>(
&'f1 self,
search: &'f2 str,
) -> EverythingClientQueryBuilder<'f1, 'f2>
pub fn query<'f1, 'f2>( &'f1 self, search: &'f2 str, ) -> EverythingClientQueryBuilder<'f1, 'f2>
Send a query to Everything
§Important Note
Everything only handles one query per window at a time. Sending another query when a query has not completed will cancel the old query.
This method serializes queries by replacing the previous sender. Callers should wait for the receiver before calling again.
§Example
use std::time::Duration;
use everything_ipc::wm::{EverythingClient, RequestFlags};
let everything = EverythingClient::new().unwrap();
// These queries will be serialized (not sent concurrently)
let receiver1 = everything
.query("search1")
.request_flags(RequestFlags::FileName)
.call()
.unwrap();
let result1 = receiver1.recv_timeout(Duration::from_secs(5)).unwrap();
// Now safe to send next query
let receiver2 = everything
.query("search2")
.request_flags(RequestFlags::FileName)
.call()
.unwrap();
let result2 = receiver2.recv_timeout(Duration::from_secs(5)).unwrap();Sourcepub fn query_wait<'f1, 'f2>(
&'f1 self,
search: &'f2 str,
) -> EverythingClientQueryWaitBuilder<'f1, 'f2>
pub fn query_wait<'f1, 'f2>( &'f1 self, search: &'f2 str, ) -> EverythingClientQueryWaitBuilder<'f1, 'f2>
Send a query to Everything and wait for the result
This method serializes queries to work around Everything’s single-query-per-window limitation. Only one query can be sent at a time per reply window.
Source§impl EverythingClient
impl EverythingClient
Sourcepub fn query_tokio<'f1, 'f2>(
&'f1 self,
search: &'f2 str,
) -> EverythingClientQueryTokioBuilder<'f1, 'f2>
pub fn query_tokio<'f1, 'f2>( &'f1 self, search: &'f2 str, ) -> EverythingClientQueryTokioBuilder<'f1, 'f2>
Send a query to Everything asynchronously
§Important Note
Everything only handles one query per window at a time. Sending another query when a query has not completed will cancel the old query.
This method serializes queries by replacing the previous sender. Callers should await the receiver before calling again.
§Example
use everything_ipc::wm::{EverythingClient, RequestFlags};
let everything = EverythingClient::new().unwrap();
// These queries will be serialized (not sent concurrently)
let receiver1 = everything
.query_tokio("search1")
.request_flags(RequestFlags::FileName)
.call()?;
let result1 = receiver1.await?;
// Now safe to send next query
let receiver2 = everything
.query_tokio("search2")
.request_flags(RequestFlags::FileName)
.call()?;
let result2 = receiver2.await?;Sourcepub fn query_wait_tokio<'f1, 'f2>(
&'f1 self,
search: &'f2 str,
) -> EverythingClientQueryWaitTokioBuilder<'f1, 'f2>
pub fn query_wait_tokio<'f1, 'f2>( &'f1 self, search: &'f2 str, ) -> EverythingClientQueryWaitTokioBuilder<'f1, 'f2>
Send a query to Everything asynchronously and wait for the result
This method serializes queries to work around Everything’s single-query-per-window limitation. Only one query can be sent at a time per reply window.
Methods from Deref<Target = IpcWindow>§
pub fn wm_client(&self) -> Result<EverythingClient, IpcError>
Sourcepub fn class_name(&self) -> &str
pub fn class_name(&self) -> &str
Class name of the IPC window.
pub fn instance_name(&self) -> Option<&str>
Sourcepub fn is_ipc_available(&self) -> bool
pub fn is_ipc_available(&self) -> bool
Check if IPC is available
Sourcepub fn get_version(&self) -> Version
pub fn get_version(&self) -> Version
Get the version of Everything
Sourcepub fn is_db_loaded(&self) -> bool
pub fn is_db_loaded(&self) -> bool
Check if the database is loaded
Sourcepub fn is_file_info_indexed(&self, info: FileInfo) -> bool
pub fn is_file_info_indexed(&self, info: FileInfo) -> bool
Check if info is indexed