pub struct LazyClient { /* private fields */ }Expand description
The daemon connection a CLI command or the MCP server makes on first use, and again once its daemon hung up.
Implementations§
Source§impl LazyClient
impl LazyClient
pub fn new(paths: &Paths) -> LazyClient
Sourcepub fn with_client(paths: &Paths, client: Client) -> LazyClient
pub fn with_client(paths: &Paths, client: Client) -> LazyClient
Starts out with a connection the caller made.
Sourcepub fn client(&self) -> Result<Arc<Client>>
pub fn client(&self) -> Result<Arc<Client>>
The connection, starting the daemon when none answers.
Sourcepub fn request<T>(
&self,
account: &str,
command: Command,
pick: impl FnOnce(Event) -> Result<T, Event>,
) -> Result<T>
pub fn request<T>( &self, account: &str, command: Command, pick: impl FnOnce(Event) -> Result<T, Event>, ) -> Result<T>
The daemon’s reply to command, as far as pick takes it; any other reply is an error.
Sourcepub fn apply(
&self,
account: &str,
folder: &str,
uids: &[u32],
action: &Action,
by: &str,
) -> Result<EventResults>
pub fn apply( &self, account: &str, folder: &str, uids: &[u32], action: &Action, by: &str, ) -> Result<EventResults>
Runs a direct action through the daemon; the outcome per uid.
Sourcepub fn apply_rule(
&self,
account: &str,
name: &str,
) -> Result<(usize, usize, Vec<String>)>
pub fn apply_rule( &self, account: &str, name: &str, ) -> Result<(usize, usize, Vec<String>)>
Runs rule name over the account’s existing mail through the daemon: messages evaluated, actions taken, and
the errors that did not stop the run.
Sourcepub fn search_server(
&self,
account: &str,
folder: Option<&str>,
query: &str,
) -> Result<Vec<(String, u32)>>
pub fn search_server( &self, account: &str, folder: Option<&str>, query: &str, ) -> Result<Vec<(String, u32)>>
Searches the account’s server for every word of query, in folder or every folder; the stored hits.
Auto Trait Implementations§
impl !Freeze for LazyClient
impl RefUnwindSafe for LazyClient
impl Send for LazyClient
impl Sync for LazyClient
impl Unpin for LazyClient
impl UnsafeUnpin for LazyClient
impl UnwindSafe for LazyClient
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