Skip to main content

LazyClient

Struct LazyClient 

Source
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

Source

pub fn new(paths: &Paths) -> LazyClient

Source

pub fn with_client(paths: &Paths, client: Client) -> LazyClient

Starts out with a connection the caller made.

Source

pub fn client(&self) -> Result<Arc<Client>>

The connection, starting the daemon when none answers.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn restore(&self, account: &str, file: PathBuf) -> Result<String>

Appends a trashed .eml back into its folder through the daemon; the folder it went to.

Source

pub fn raw_message( &self, account: &str, store: &Store, msg: &Message, ) -> Result<Vec<u8>>

The message’s full raw bytes: from the store, or fetched through the daemon once; a stored body needs no daemon.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more